IF/THEN by decimal only

Good morning!

I’m trying to figure out a formula or expression to solve a problem by looking at numbers after the decimal only.

For example:
IF “CELL” is XX.25 or less then rounddown, multiply x2, add 1
IF “CELL” is XX.26 or greater then rounddown, multiply x2, add 2

I’m not sure of the appropriate verbaige to search successfully. I’ve looked through the documentation for “IF” and I suspect that this falls outside of the standard usage.

I appreciate any help! Thank you!

Let’s say your cell is A9:
=IF(MOD(A9,1)<=0.25,INT(A9)*2+1,INT(A9)*2+2)

Please in formula expression examples here use ; semicolon as function parameter separator, as that is accepted in all locales’ settings and thus the expression can be copy-pasted. (even if converted to , comma after the expression was entered in a setting that uses comma). i.e.

=IF(MOD(A9;1)<=0.25;INT(A9)*2+1;INT(A9)*2+2)

Btw, the INT(A9)*2 can be extracted from the IF() to form a shorter expression:

=INT(A9)*2+IF(MOD(A9;1)<=0.25;1;2)

Note that the original question did not specify what should happen for values between xx.25 and xx.26, but the assumption that the second condition was actually meant for values >xx.25 is likely valid.

Thank you!!! That worked exactly as I described. I appreciate the assistance!

Since you were so helpful with the first part of the calculation perhaps you would be willing to help with the second part.

Now I’m trying to perform an operation if the number falls between a range.

IF x = a number between 0-8 then /1
IF x = a number between 8.01-16 then -.5 /2
IF x = a number between 16.01-24 then -1 /3
IF x = a number between 24.01-32 then -1.5 /4
IF x = a number between 32.01-40 then -2 /5
IF x = a number between 40.01-48 then -2.5 /6
IF x = a number between 48.01-56 then -3 /7

And so on. Thank you again for the assistance with the first problem!

I think I found a solution here:

1 Like