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!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

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,958
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,958
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,958
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Yes, specifically any number not equal to 0 will equate to TRUE.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,302
Messages
5,836,498
Members
430,436
Latest member
fefenouil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top