Returning different values for a similar error (Dividing by 0)

Paprika

New Member
Joined
Oct 28, 2012
Messages
2
Hello! I'm very new to Excel.

I have a spreadsheet where oftentimes my denominator is 0 (it's frustrating, but that's how my work wants it done).

Basically, if the number is 0/0 I want it to come up as "-". If the number is (>0)/0, I want it to return 100%.

I know that the error is technically the same error, so I can get it to return 100% or -, but not an either/or type situation. Is this possible? Hope I made sense.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi, how about something like:

Sheet1


*
A
B
2
-
3
*
4
20
100%
5
*
6
20
10%
7
200
*

<tbody>
</tbody>

Spreadsheet Formulas

Cell
Formula
B2
=IF(AND(A2=0,A3=0),"-",IF(AND(A2<>0,A3=0),1,A2/A3))
B4
=IF(AND(A4=0,A5=0),"-",IF(AND(A4<>0,A5=0),1,A4/A5))
B6
=IF(AND(A6=0,A7=0),"-",IF(AND(A6<>0,A7=0),1,A6/A7))

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie Html" target="_blank"> Excel Jeanie HTML 4
 
Upvote 0
Hello! I'm very new to Excel.

I have a spreadsheet where oftentimes my denominator is 0 (it's frustrating, but that's how my work wants it done).

Basically, if the number is 0/0 I want it to come up as "-". If the number is (>0)/0, I want it to return 100%.

I know that the error is technically the same error, so I can get it to return 100% or -, but not an either/or type situation. Is this possible? Hope I made sense.
What version of Excel are you using?
 
Upvote 0
Hello! I'm very new to Excel.

I have a spreadsheet where oftentimes my denominator is 0 (it's frustrating, but that's how my work wants it done).

Basically, if the number is 0/0 I want it to come up as "-". If the number is (>0)/0, I want it to return 100%.

I know that the error is technically the same error, so I can get it to return 100% or -, but not an either/or type situation. Is this possible? Hope I made sense.

Either...

=IF(B1,A1/B1,IF(A1,1,"-"))

Or...

=IF(B1,A1/B1,IF(A1,1,0))

which can be custom-formatted as:

[=0]"-";0%
 
Upvote 0
Maybe this way (works for any version of Excel)(assuming Columns A and B contain your values)...

=IF(OR(A2="",B2=""),"",IF(B2<>0,A2/B2,IF(A2=0,"-",1)))

Note that this formula can be copied down past existing data in anticipation of future data... it display the empty string ("") if either cell does not contain a number yet.
 
Upvote 0

Forum statistics

Threads
1,215,474
Messages
6,125,024
Members
449,204
Latest member
LKN2GO

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