How can I only run a calculation in Google Sheets, if the cell is not empty?

Viewed 2371

basically, I'd like to get the percentage differences between two numbers, but only if there is data/numbers in those cells.

I don't want the formula to run if there is not any data in the cell, as this will give me a div error.

1 Answers

try IF:

=IF((A1<>"")*(B1<>""), A1-B1, )

if A1 and B1 is not empty do A1-B1 otherwise do nothing

Related