# IF Formula - If Qty equals "0" I would like to output "0" in a specific column, and if not, I would like to perform a formula

Hi - I am currently using this formula ({Rate}*{Quantity})+{.01% of Asset Value} to calculate total storage fees which shows up in our {Total} column. This formula is working great except when the number in the {Quantity} column equals “0” I need the {Total} column to not perform this formula and simply output “0”.

I’m assuming I need to use the IF function, but I am having trouble with the formula! This is exactly what I am trying to accomplish:

• If Quantity=0, output 0 in total column
• If Quantity doesn’t equal 0 perform this formula: ({Rate}*{Quantity})+{.01% of Asset Value}

You’ve basically got it. Just write what you wrote
`IF(({Quantity} + 0) = 0, 0, ({Rate} * {Quantity}) + {.01% of Asset Value})`

({Quantity} + 0) will return 0 when {Quantity} is 0 AND when {Quantity} is blank.

Thank you, @JCorrell! That worked beautifully! I don’t quite understand why I need the {Quantity} + 0 part. Can you elaborate on that part of the formula just so that I understand?

Sure.

If we were to write the formula like this:
`IF({Quantity} = 0, 0, ({Rate} * {Quantity}) + {.01% of Asset Value})`

It would work just fine… As long as {Quantity} ALWAYS had a number in it. However, if ever was blank, i.e., nothing… not “0”, just blank, then our formula would return {.01% of Asset Value}.

There certainly are cases where you might want to distinguish between blank and “0”. But that did not seem to be the case here.

Another way that we could write it would be:
`IF(OR({Quantity} = 0, {Quantity} = ""), 0, ({Rate} * {Quantity}) + {.01% of Asset Value})`

Make sense?

Aha, yes that makes sense. Thank you!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.