How can a logical test equal one cell?

Mtyler

Board Regular
Joined
Oct 13, 2006
Messages
62
I'm confused.

I'm reviewing someone else's work and they have used the following if formula

=+IF(D15,D15/E15-1,"")

Cell D15 does not contain anything other than a hard coded number.

Surely this if function is useless, even if D15 contains nothing?

Thanks

Matt
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
As far as excel is concerned,
0 (or Blank) = FALSE
ANY OTHER NUMBER = TRUE

Hope this helps...
 
Upvote 0
Surely this if function is useless

Most definately NOT useless...

Say you want to Devide B1/A1
=B1/A1
But if A1 is Blank or 0, you get #DIV/0! Error

Some would use
=If(Iserror(B1/A1),"",B1/A1)
to account for that...

But it is much easier to do this instead

=If(A1,B1/A1,"")
 
Last edited:
Upvote 0
Thanks for your replies...

So, If(D5,.... essentially removes any errors that may result from the logical test cell being 0 or blank.

I see.

Thank you!
 
Upvote 0
Hi Jonmo,
This formula isn't suppressing a division by zero error. Look again; it's testing the numerator, not the demoninator.
 
Upvote 0
You'd better check again Geoff....

the number to the RIGHT of the / is the number that causes #DIV/0 Errors.
 
Upvote 0
Yes, the number to the RIGHT is the one that causes the error, but in the formula the number to the LEFT is the one being tested, so the formula can't be a test for a DIV/0 error.

Or am I just being thick?
 
Upvote 0
VISUALLY in the spreadsheet, yes A1 is to the LEFT of B1...

But in my example Formula, it's the other way around..

B1/A1
 
Upvote 0
I'm definitely being thick, but bear with me...

In the formula posted at the top of the thread, the logic is "If D15's got something in it, divide it by E15 and then take away 1". In that formula, E15 would be the one causing the DIV/0 error, so why test D15?
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,181
Members
448,871
Latest member
hengshankouniuniu

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
Back
Top