How to display N/A when using variance formula for + or - and - or + sings

krodriguez

Board Regular
Joined
Jul 11, 2012
Messages
119
Hello,

I have the following formula on A3 = A2/A1 basically what I want my formula to read is that if we have negative with positives numbers or viceversa in cells A2 or A1 give me a N/A results, if my signs on both cells are negative or positive give the result and not N/A

Thanks!
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
the formula works when my cells are next to each other in this case A1:A2 =if(sumproduct(sign(a1:a2)),a2/a1,"n/a") that works
but it wont give the correct result if I have another number in between, example A1 = 1 A2 = -2 A3 = -2 if I want the result of A1 and A3 which should give me N/A (positive and negative sign) I get a number instead of N/A
 
Upvote 0
Then you can:

1. Swap the SUMPROODUCT for SUM
2. Catch each cell reference in a SIGN function, and separate them with a comma

=IF(SUM(SIGN(A1),SIGN(A3)),A3/A1,"n/a")
 
Upvote 0
Why such a complexity? If the numerator and denominator have different signs (the "N/A" case), the resulting ratio will be negative. Otherwise, the ratio will be non-negative. Thus the simple formula offered in Post # 4.
 
Upvote 0
Why such a complexity? If the numerator and denominator have different signs (the "N/A" case), the resulting ratio will be negative. Otherwise, the ratio will be non-negative. Thus the simple formula offered in Post # 4.
Agreed



Maybe just

=IF(A2/A1<0,"N/A",A2/A1)
If I am not mistaken, I think computers perform multiplication more efficiently than division. Given that, I might have written your formula this way...

=IF(A1*A2>0,A2/A1,"N/A")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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