Reputation: 375
I am trying to add/prefix a plus sign "+" if the value is negative. e.g. +10
I have sheet where some bill payments are made and sometimes they overpay. So, the Balance column should reflect like +(over paid value).
I tried with =CONCATENATE
but this does not help. It comes as +-10
=IF(C2<0,CONCATENATE("+",C2),"")
Upvotes: 20
Views: 32749
Reputation: 4450
You can try going to Format > Number > More formats > Custom number format
and inserting the following expression: +0;-0;0
This will cause negative values to be show with a +
sign, and positive ones to be shown with a -
sign. The value that it holds, however, will still be the original one (as a number).
See docs (code formatting added):
When creating a custom format, note that the formatting can consist of up to 4 parts separated by semicolons:
positive;negative;zero;non-numeric
.
Upvotes: 44
Reputation: 1
all you need is this:
=IF(A2-B2<0, A2-B2*-1, )
then Arrayformula would be:
=ARRAYFORMULA(IF(A2:A-B2:B<0, A2:A-B2:B*-1, ))
Upvotes: 0
Reputation: 1330
If you're sure that all cells will have numbers, then you may format cells to have "Number" rather than "General". Then, rewrite your condition as follows: =IF(C2<0,CONCATENATE("+", -1 * C2),"")
.
I hope it helps.
Upvotes: 0