If condition

  • Thread starter Thread starter Michel Khennafi
  • Start date Start date
M

Michel Khennafi

Happy new year to all of you...

I am creating a spreadsheet and I would like to test two cells values before
calculating in a third one.
Very simple operation A1/B1 but how to create the condition that says if A1
is empty or blank and If B1 is empty or blank then C1=BLANK if not then
A1/B1

Kind regards from Brew City Milwaukee

Michel
 
=IF(AND(A1<>0,B1<>0),A1/B1,0)

that will do what you want, with the exception of leaving the third cell
blank if a and/or b are blank
not sure if you can leave it blank. that last ,0 will fill in with 0 else it
will display FALSE
 
Happy new year to all of you...

I am creating a spreadsheet and I would like to test two cells values before
calculating in a third one.
Very simple operation A1/B1 but how to create the condition that says if A1
is empty or blank and If B1 is empty or blank then C1=BLANK if not then
A1/B1

Kind regards from Brew City Milwaukee

Michel

I suspect that you do not mean precisely what you have written, however:

C1: =IF(OR(ISBLANK(A1),ISBLANK(B1)),"BLANK",A1/B1)

will do what you have written.

Note that there is no test for "ISEMPTY" in Excel. In VBA, "EMPTY" refers to a
variable which has not been initialized, not to a worksheet cell.

Note also that if, instead of the literal word "BLANK" in C1, you wish to have
C1 take on the state of literally being blank, that is not possible with a
formula; since the formula has to reside in C1 which would, by definition, then
make C1 not blank.

So, with that in mind, perhaps

C1: =IF(ISERROR(A1/B1),"",A1/B1)

or some variation might be a desired solution.

C1 will display a null string, or appear to be empty or blank, although it
really is not empty or blank.

If you truly want C1 to be blank, then you will need a VB solution.


--ron
 
Back
Top