# Returning + or - for a number result?

#### hoff123

##### Board Regular
Hi All,

I am trying to work out a function to do the following (but not with much luck).

= A1 – B1. If the result is a positive number return +#. If the result is a negative number return -#

Seems simple enough but just got a brain freeze for a Monday morning!

Thanks!

### Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
use the formula:

if(c1>0,"+#","-#")

hell, hoff123,
try this
=SIGN(A1 -B1)
this will return zero if A1 = B1
kind regards,
Erik

variation on the theme:

=CHOOSE(SIGN(A1)+2,"-",0,"+")

NICE!
but do yo mean
=CHOOSE(SIGN(A1-B1)+2,"-",0,"+") ?

"but do yo mean..."

Yep - thanks for that.

Why not just use a custom format?

+#;-#

Norie said:
Why not just use a custom format?

+#;-#
FINE! how do you avoid the "+" when the result is ZERO ?

Well you would add the zero part to the custom format.

As the OP didn't specify what they would like for that I left it out.

+#;-#;"zero"

I was lazy, but now figured it out. Thanks for not giving the solution , allowing me to think about...
+#;-#;0
best regards,
Erik

Replies
5
Views
285
Replies
3
Views
726
Replies
4
Views
602
Replies
1
Views
208
Replies
2
Views
461

1,203,189
Messages
6,054,002
Members
444,696
Latest member
VASUCH

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back