Averages : exclude past month, exclude 0, ignore #div/0

rshankey

New Member
Joined
Apr 25, 2016
Messages
8
Example data Below is what I have as my first week of the month for tracking employe status'.
(details)
The cells are using the following formula to pull their data from another sheet.
{=SUM(IF($B$1&G$55=admp!$O$2:$O$10025,admp!$G$2:$G$10025))} , with this I am matching employe name (b1) and dates, to get my data pulled from a data sheet.
For the first week of the month I am looking to exclude the previous months data using the formula below:
=AVERAGEIF($C$55:$G$55,">="&DATE(YEAR(TODAY()),MONTH(TODAY()),1),C56:G56)
cdefghij
5528-Mar-1629-Mar-1630-Mar-1631-Mar-161-Apr-16BaselineAverageMetric
56000702435543After Call
57000527313031Lunch
58000284151515Break
59000178101510Personal

<tbody>
</tbody>


All of this seems to work without issue. Then I found some days (this last week of the month) where employees were either not present or left early, causing status' to have a 0 time.

At this time I need to be able to average the individual rows while ignoring 0 which I was able to do with :
=AVERAGEIF(C74:G74,"<>0")
This works and ignores zero's, however I have some employee's who have nothing but 0 for status' for this week and using the above formula provides a #div/0! error, which I understand but need to get around.

I had some help to write =IF(ISERROR(AVERAGE(C80:G80)),0,(AVERAGE(C80:G80)))
but this ends up including 0 in the averaging. Is there a better way to average these rows and return a 0 or blank instead of an err if only zero's are present to average

Below is what I have for an employe this week who has missed days and had to leave early, and as a result only has minimal data to average.

cdefghij
7925-apr-1626-apr-1627-apr-1628-apr-1629-apr-16BaselineAverageMetric
80002100554.20After Call
8100000300.00Lunch
8200000150.00Break
8300000150.00Personal

<tbody>
</tbody>

using =AVERAGEIF(C80:G80,"<>0") I get the correct result of 21 for the aftercall status. Though because the employee has missed time does not have data for any of the other status and the above formula provides a #div/0 which then provides a #div/0 error when I try to average thats status's weekly averages for the month.
this is where I tried the =IF(ISERROR(AVERAGE(C80:G80)),0,(AVERAGE(C80:G80)))
but the result was 4.2 which is 0+0+21+0+0/5

Any insights would be greatly appreciated. This forum has helped me get this sheet up and running. Hopefully you guys can get me through this last little bit.

Regards,
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi,

With the provided information given i would think the solution isn't in the logic you use to average your data but will be in the logic you use to summarize the data into the provided table's. You almost figured it out by saying "where employees were either not present or left early, causing status' to have a 0 time."

What you tried was to exclude the 0 in your calculation but what you've forgot is: 0 time can be a valid result from the formula if an employee is actually present.

So my guess would be to:

  1. Change the formula you're using to pull data to your summary and have it reflect a <blank> blank if there's no data (caused by the employee either not present or left early) instead of 0 and use the 0 just as a result of pulled data (caused by a present employee not doing the task).</blank>
  2. Revert the average formula's to the original ones without excluding the 0.

Hope this helps.
 
Last edited:
Upvote 0
Hi,

Try
Code:
=IFERROR(AVERAGE(IF(ISERROR($C80:G80), FALSE,
                 IF($C80:G80<>0,IF($C$55:G$55>=DATE(YEAR(TODAY()),MONTH(TODAY()),1),$C80:G80)))),
         "Not enough data")
Validate with [Ctrl]+[Shift]+[Enter] (array formula) and copy down as necessary

Regards
XLearner
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,262
Members
449,075
Latest member
staticfluids

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