TheIronKnuckle
TheIronKnuckle

Reputation: 7294

Seemingly pointless excel formula

I'm debugging a massive spreadsheet, and I've come across this wierd little formula in multiple places:

=IF(P6="", "", P6)

No matter what, that cell is going to be equal to P6. Any pointers as to why the original author from way back when didn't just go

=P6

instead?

I've made sure that there's no macro magic going on behind the scenes, throwing and catching events and whatnot.

Upvotes: 2

Views: 137

Answers (1)

Jason Sperske
Jason Sperske

Reputation: 30436

Actually (and I had to try this to be sure), =P6 and =IF(P6="", "", P6) have different behaviors. If P6 is empty then =P6 will return 0, while the formula will return an empty cell. This looks like it is for formatting purposes, because an empty cell and 0 will behave the same way in aggregate functions like SUM. Personally I find that "Accounting format" for numbers is cleaner where zero is represented as a discrete -.

Upvotes: 4

Related Questions