if & or functions???

Elise Nerlove

Board Regular
Joined
Dec 17, 2009
Messages
94
Hi,

I need help with an equation:

If column A = nothing AND column B = nothing, then do nothing. But if a value appears in either column a or b then do the equation: b-a=c

im thinking the equation is: =if(a="",andif(b="","",b-a))

but this is outputting "FALSE" for all rows....any ideas?

Thanks so much for the help!!! greatly appreciated!
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

ljungren13

Board Regular
Joined
Jun 4, 2010
Messages
195
Does this work:

=IF(A1="","",IF(B1="","",B1-A1))

or this:

=IF(AND(A1="",B1=""),"",B1-A1)

depending if i misunderstood you
 
Last edited:

Elise Nerlove

Board Regular
Joined
Dec 17, 2009
Messages
94
Thanks so much!!

prabby, that equation didnt quite work, but ljungren13 your equation worked!!

Problem solved, thanks!

Elise
 

prabby25101981

Active Member
Joined
Jul 28, 2010
Messages
348

ADVERTISEMENT

Did you want to check if one of A1 or B1 is blank or both blank. In case you wanted to display "" if any of these are blank, then use this -

=IF(OR(ISBLANK(A1),ISBLANK(B1)),"",B1-A1)
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,955
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Why not use COUNT?

=IF(COUNT(A1:B1)=2,B1-A1,"")
 

omicronkappa278

New Member
Joined
Aug 2, 2010
Messages
3

ADVERTISEMENT

Seems to me that she was looking for an or situation. The Count works great, but maybe like this for OR?

=IF(COUNT(A1:B1)>0,B1-A1,"")

This satisfies the OR in her needs. Seems like if both are BLANK then do nothing and if EITHER has a value then b-a.

cheers,

omicronkappa278
louisiana
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,955
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
If it's either, then:

=IF(COUNT(A1:B1),B1-A1,"")
 

omicronkappa278

New Member
Joined
Aug 2, 2010
Messages
3
Ah yes... no need for the ">0" because the if will treat anything greater than 0 as a True right?
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,955
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Yes, specifically any number not equal to 0 will equate to TRUE.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,258
Messages
5,527,662
Members
409,781
Latest member
Maxcwy2020

This Week's Hot Topics

Top