Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Calculations

Status
Not open for further replies.

CarolOB

Programmer
Sep 6, 2001
36
US
Good Morning,
Is there a way to do the following in Excel?

Suppose you have a value like 38 in J2 and a value like 36 in J3. I want to subtract J3 from J2, but if the value in J3 is LESS than the value in J2, I want the answer to show as a negative number (ie -2 in this case) and if the value in J3 is MORE than the value in J2, I want the answer to show as a plus (ie +2 if the value in J3 was 40).

I would appreciate it very much if anyone can help me with this.

Thanks. CarolOB
 
If you just want the vlaues to show as the opposite of what they are use formatting. The following custom format will do what you want, but the actual value of the result does not change, so that in any further calculation a number showing the "+" sign will be treated as a negative.

-#,##0 ; +#,##0

If you want the actual value to change as well, just multiply th eresult by minus 1, e.g. =(J2-J3)*-1 or else reverse the formula to =J3-J2.

In this case you need a custom format :

+#,##0 ; -#,##0

A.C.
 
Surely, what you want to do is simply subtract J2 from J3, which will give the results you want. If you want the results to show a plus sign for positive results, just do a custom number format of
+#,##0;-#,##0

Hope that helps,
GlennB
 
Thank you both - that works fine!

Have a nice day! CarolOB
 
Thank you both - it works fine!

Have a nice day!
CarolOB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top