# Excel: If cell<>0, then do this formula

I need a formula that does two things:

1. Checks to see if the inputted value is 0
2. If that value is not 0, then checks to see if that inputted value divides cleanly by 13.

Here's what I have, and it is not accepting 0. Any help/direction would be appreciated.

``````=IF(M10<1, 0, if(MOD(M10/13,1)=0,M10,0))
``````

I'll do what you asked in question first:

``````=IF(M10 = 0,
do something if it is equal to 0 ,
IF(MOD(M10, 13) = 0,
do something if it is divisible by 13
)
)
``````

`MOD` takes two parameter as input:

1. The number
2. The divisor, in this case 13

Your formula is wrong because you divide `M10` by 13, rather than putting the 13 in the second parameter.

• Thanks. If I wanted to simply display the cell value if M10=0, what would that look like? – brkville42ny Jun 6 '17 at 20:43
• Just put `M10` on the first `IF`, or `0`, both shows the cell value, which is `0` – Vylix Jun 6 '17 at 20:46
• OK. When I try to use this formula and enter 13 into M10, it throws a "value you entered is not valid error." `IF(MOD(M10, 13), M10, 0)` – brkville42ny Jun 6 '17 at 20:48
• My bad, see my code fix. It should have `MOD(M10, 13) = 0` – Vylix Jun 6 '17 at 20:51