Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-14-2021, 08:05 AM
teza2k06 teza2k06 is offline IF Statement Windows 10 IF Statement Office 2010 32bit
Advanced Beginner
IF Statement
 
Join Date: Feb 2013
Posts: 37
teza2k06 is on a distinguished road
Default IF Statement

Hi All,
For some reason I seem to be stuck on a formula which should be simple to do

Formula in cell D2


Start date in cell B2
Column D is known as "End Date"

So far I have got as far as - =IF(A2="Night", B2+1,B2)

What I have done so far is, if A2="Night" then it is adding 1 day to the start date, to give the end date. If it does not equal "Night" then the end date will be the same as the start date.
However, what I want it to do is add 1 day to the start date, if A2= Night or Night (B) - But I can't seem to get it working.

Any help would be much appreciated.
Reply With Quote
  #2  
Old 11-14-2021, 09:33 AM
Logit Logit is offline IF Statement Windows 10 IF Statement Office 2007
Expert
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

=IF(A2="Night", B2+1,B2)

The formula works fine here :

https://www.amazon.com/clouddrive/sh...H10mVuIWdGMjf5
Reply With Quote
  #3  
Old 11-14-2021, 04:30 PM
joeu2004 joeu2004 is offline IF Statement Windows 7 32bit IF Statement Office 2007
Advanced Beginner
 
Join Date: Aug 2016
Posts: 32
joeu2004 is on a distinguished road
Default

I would write:

=IF(OR(A2={"Night","Night (B)"}), B2+1, B2)


Alternatives:


=IF(OR(A2="Night",A2="Night (B)"), B2+1, B2)
or
=IF(LEFT(A2,5)="Night", B2+1, B2)


Caveat: The last formula chooses B2+1 when A2 is __any__ string that begins with "Night". For example, "Night (C)". Do not use it unless you want that flexibility.
Reply With Quote
  #4  
Old 11-15-2021, 01:45 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline IF Statement Windows 7 64bit IF Statement Office 2010
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,766
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

Slight variation on the precedent solution =OR(A2={"Night","Night (B)"})+B2
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a Select statement in Excel to an update statement shabbaranks Excel Programming 5 10-31-2018 11:47 PM
Help with IF statement kevinU Excel 0 03-15-2017 02:11 PM
IF Statement IF statement mrry475 Excel 1 09-06-2016 09:30 AM
IF Statement Need a little help with an if statement cangelis Excel 2 04-08-2015 05:55 PM
Add a statement sma Word 6 03-23-2014 10:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft