Forum Discussion
Xnex66
Jun 08, 2021Copper Contributor
Can I use an "IF" function to return a "0" if true and to perform a calculation if not true
Hello, I am attempting to write a formula which takes an inventory number which I input and compares it with what is expected to be on hand. If my count matches what is expected to be on hand then th...
- Jun 08, 2021
Xnex66 Something like this?
=IF(H6>G6,H6-G6,0)This calculates H6-G6 if H6 is greater than G6. Anything else returns 0.
Or a more funky formula could be:
=(H6-G6)*--(H6>G6)
Xnex66
Jun 08, 2021Copper Contributor
Thank you so much for taking time to help me out Riny, that worked like a charm and was much more simple and elegant than any monstrosities I was attempting to use.
- Riny_van_EekelenJun 08, 2021Platinum Contributor
Xnex66 Glad it worked!