Hello, can you please help me understand why the formula is resulting in #div/0 & not the desired average even though I have name ranges for each column ? I have the ISERROR Exception for the #Div/0. However, it works if I use a literal hour for the aHours where the Choose() is.
=IF(ISERROR((SUMPRODUCT(--(wekday=CHOOSE(WEEKDAY(B2),"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")),--(HOUR(wekdate)=CHOOSE(aHours,"23",22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)),--(Hdcnt)))/SUMPRODUCT((HOUR(wekdate)=CHOOSE(aHours,"23",22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)*(wekday=CHOOSE(WEEKDAY(B2),"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"))))),"",(SUMPRODUCT(--(wekday=CHOOSE(WEEKDAY(B2),"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")),--(HOUR(wekdate)=23),--(Hdcnt)))/SUMPRODUCT((HOUR(wekdate)=CHOOSE(aHours,"23",22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)*(wekday=CHOOSE(WEEKDAY(B2),"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")))))
Date Day_of_Week Hourly_Hours Headcount
02/20/2010 23:00 Saturday 23 275
02/20/2010 23:00 Saturday 23 300
02/13/2010 23:00 Saturday 23 300
Last edited by NBVC; 02-25-2010 at 04:36 PM. Reason: data
It would be better to see the workbook in question...
Why does the 23 have quotes around it...
Do you need to format ahours as number? or have all those entries in the Choose function with quotes...
Also, the Choose (weekday(),"Monday","Tuesday", etc) function can probably be replace with just TEXT(B2,"DDDD")
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
I tried using the quotes to see if that helped. I Formated all columns as well. I actually started with Text(B2, "DDDD"). But thought Choose() would help match with the hour column.
Can you show sample expected outcomes and explain what exactly you are trying to do.. in words.
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
The goal is to plot a 3-line graph with 0-23 being the x-axis & total head counts, Avg head counts by weekday&hr, & then avg head counts by weekday & hr & siteid beig the Y-axis. I ran into trouble starting from the pivot table. So now I'm graphing from the 3 ranges.
Weekday Hourly_Hour Average 'Head Count' TOTAL AVG/SITEID/HR
SFO 02/12/2010 00:00 Friday 0 26 17.67 38.6
SFO 02/05/2010 00:00 Friday 0 15 17.67 38.6
SFO 01/29/2010 00:00 Friday 0 12 17.67 38.6
LAX 08/21/2009 00:00 Friday 0 76 70 38.6
LAX 08/14/2009 00:00 Friday 0 64 70 38.6
Last edited by ackrite55; 02-25-2010 at 04:24 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks