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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

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,953
Office Version
365, 2010
Platform
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,953
Office Version
365, 2010
Platform
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,953
Office Version
365, 2010
Platform
Windows
Yes, specifically any number not equal to 0 will equate to TRUE.
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,706
Messages
5,512,954
Members
408,928
Latest member
Black Vinyl

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top