Avoiding the #div/0! error

erniepoe

Active Member
Joined
Oct 23, 2006
Messages
375
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I've currently got a formula that is working fine, it finds the average salary of a table based on both job title and job location, but if it returns an error (for instance, user selects a location that doesn't have that job, the formula simply returns the average salary of that job in all locations.

However, since the table to be presented to the end user doesn't have the job title or location selected yet, all of the unfilled cells are returning with the #div/0 error. One easy fix is to just go in and select random drop downs, but is there an easy way to tweak the below formula so that it returns no value unless title and location are selected, at which point the formula would kick in. I just don't like to look at the #div/o, and would prefer to not do so.

Thanks so much,
Ernie




=IFERROR(AVERAGEIFS(Table2[Annual Salary],Table2[Job Title],[@[Job Title]],Table2[Location],[@Location]),SUMIF(Table2[Job Title],[@[Job Title]],Table2[Annual Salary])/COUNTIF(Table2[Job Title],[@[Job Title]]))
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
A few options:
You can hide the error with Conditional Formatting.
It's hard to tell where your 0 is coming from exactly in your formula, but you can build an IF in there somewhere to check for 0, basic syntax: =IF(B1,A1/B1,"")
You can possibly build it into your IFERROR, but I'm not quite sure what your formula is doing exactly.
 
Upvote 0

Forum statistics

Threads
1,215,647
Messages
6,126,005
Members
449,280
Latest member
Miahr

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