Formulas - #DIV/O! Result

NICOLAW

New Member
Joined
Aug 2, 2007
Messages
7
Hi All

I am trying to work out if there is an excel formula to calculate the below.....

I have 2 cells A & B and if i divide A by B and the result is 0 (ie there being 0 in both A & B) I get a #DIV/O! result when I need it to show a 0

Can anyone help with this? Thanks, Niki
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
Try this:
Code:
=IF(B1<0.1,0,A1/B1)
This will result in 0 when B is zero or blank.
 

dave3009

Well-known Member
Joined
Jun 23, 2006
Messages
7,128
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. Mobile
  3. Web
Hi

Welcome to the board

=IF(ISERROR(A2/B2), 0, A2/B2)

Placed in C2 will return a zero (0) when there is an error withh your equation.

HTH


Dave
 

NICOLAW

New Member
Joined
Aug 2, 2007
Messages
7
Thanks ever so much everyone what speedy responses!!
 

NICOLAW

New Member
Joined
Aug 2, 2007
Messages
7
Sorry just another opne now as not to sure it is working now?

This is a simple calculation of average prices for something
Eg of working sample
A1 4 ROOMS BOOKED
A2 1000 REVENUE
A3 SHOULD BE AVERAGE REV TAKEN PER ROOM A2/A1=250

So I would like a formula so if for example A1 & A2 had 0 in it it would say the averaghe would be 0 instead of #DIV/O!
 

dave3009

Well-known Member
Joined
Jun 23, 2006
Messages
7,128
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. Mobile
  3. Web
try

=IF(AND(A1=0, A2=0), 0, IF(ISERROR(A1/A2), 0, A1/A2)

I think would suit your needs

HTH


Dave
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
Try amending my original suggestion above

=IF(A1,A2/A1,0)

If that doesn't work then please explain why, what result you got and why that wasn't what you expected
 

Forum statistics

Threads
1,181,358
Messages
5,929,524
Members
436,676
Latest member
Mavri

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
Top