thepaperescape
thepaperescape

Reputation: 85

How to create Excel formula that adds a cell if it's negative or subtracts it if it's positive?

How to create Excel formula that adds a cell if it's negative or subtracts it if it's positive?

I understand I can use simple forumlas like =A37+D35 or =A37+SUMIF(D35,"<0") if I already know which direction the formula should go (adding or subtracting), but...

how do I get the formula to figure that out for me?

I want to say: "If D35 is negative ADD it to A37, BUT if it's positive SUBTRACT it from A37".

Upvotes: 0

Views: 1833

Answers (2)

viper941
viper941

Reputation: 156

You can use a simple if statement.

=IF(D35<0,D35+A37,D35-A37)

Upvotes: 1

Wyatt Shipman
Wyatt Shipman

Reputation: 1789

You can just make the field negative and it will automatically flip the sign.

=A37-D35

If D35 is negative, the double negative turns to positive.

Upvotes: 1

Related Questions