MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Help with an IF statement


Posted by Rick M on February 01, 2001 12:24 PM

I need an IF statement that will display a text "NO" if one cell compared to another cell is not divisible by a whole number.
Example:
cell A1: 20
Cell B1: 42
answer 42/20=2.1 therefore "NO"
The only variable is the quantity in A1 and B1 change depending on input.
Next time A1 could equal 4 and B1 could equal 7
Any clue?
Thanks


Posted by lander11@ford.com on February 01, 2001 12:41 PM

The Mod function returns the remainder after division,
so determine if Mod =0

Posted by Mark W. on February 01, 2001 12:47 PM

Therefore, use...

=IF(MOD(B1,A1),"NO","")

Posted by Rick on February 01, 2001 3:12 PM

TO MARK W.

Thanks - I predicted you would respond.
Works fine.... I'm learning.