A better formula?

Will85

Active Member
Joined
Apr 26, 2012
Messages
253
Office Version
  1. 365
Platform
  1. Windows
There has to be a better, more concise formula than this.

I have revenue, and I want to compute favorability between a new period and an old period.

Higher revenue in the new period than the old period is good, less is bad. The % increase or decrease should follow suit.

If the old period had zero revenue and the new period had revenue, the % increase, while not mathematical, would be positive 100%

My data starts in A2. My Fav(Unfav) calc in C2 is A2-B2 (New-Old), my % formula in D2 is as follows: =+IF(OR(A2=0, B2=0), SIGN(C2), C2/ABS(B2))

Is there a better way to compute this?

[TABLE="width: 256"]
<tbody>[TR]
[TD="class: xl64, width: 64"]New[/TD]
[TD="class: xl64, width: 64"]Old[/TD]
[TD="class: xl64, width: 64"]Fav(Unfav)[/TD]
[TD="class: xl65, width: 64"]%[/TD]
[/TR]
[TR]
[TD="align: right"]100[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]100[/TD]
[TD="class: xl63, align: right"]100%[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]-100[/TD]
[TD="class: xl63, align: right"]-100%[/TD]
[/TR]
[TR]
[TD="align: right"]-100[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]-100[/TD]
[TD="class: xl63, align: right"]-100%[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD="align: right"]-100[/TD]
[TD="align: right"]100[/TD]
[TD="class: xl63, align: right"]100%[/TD]
[/TR]
[TR]
[TD="align: right"]100[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]80[/TD]
[TD="class: xl63, align: right"]400%[/TD]
[/TR]
[TR]
[TD="align: right"]20[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]-80[/TD]
[TD="class: xl63, align: right"]-80%[/TD]
[/TR]
[TR]
[TD="align: right"]-100[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]-120[/TD]
[TD="class: xl63, align: right"]-600%[/TD]
[/TR]
[TR]
[TD="align: right"]-20[/TD]
[TD="align: right"]100[/TD]
[TD="align: right"]-120[/TD]
[TD="class: xl63, align: right"]-120%[/TD]
[/TR]
[TR]
[TD="align: right"]-100[/TD]
[TD="align: right"]-20[/TD]
[TD="align: right"]-80[/TD]
[TD="class: xl63, align: right"]-400%[/TD]
[/TR]
[TR]
[TD="align: right"]100[/TD]
[TD="align: right"]-20[/TD]
[TD="align: right"]120[/TD]
[TD="class: xl63, align: right"]600%[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You could shorten it a little bit by writing it like this:
=IF(A2*B2,C2/ABS(B2),SIGN(C2))
 
Upvote 0
If that formula gives you the results you want, then why exactly do you want something better ?

You can simplify it slightly - this appears to give the same results
=IF(B2=0,SIGN(C2),C2/ABS(B2))
 
Upvote 0
thank you. thats an interesting use of the if function.

A2*B2 doesnt really create a question that can be answered by true or false, it just is what it is.

So is the rule behind a question in IF, that anything not zero is True, and anything zero is False?



You could shorten it a little bit by writing it like this:
=IF(A2*B2,C2/ABS(B2),SIGN(C2))
 
Upvote 0
Yes, if a number is in that spot, non-zero is TRUE and zero is FALSE.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top