Trying to learn Workday but Saturday is being stubborn

Rex987456

New Member
Joined
Sep 11, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I am trying to track some averages during the week, and then on each weekend day. After some searching on the internet I found this forumla that worked for the M-F and Sunday but for some odd reason, Saturday is messed up. Can't figure out why.

For M-F I used
Code:
=SUM((WEEKDAY($E$2:$EE$2,2)<6)*($E4:$EE4)/SUM(1*(WEEKDAY($E$2:$EE$2,2)<6)))

For Saturday I used
Code:
=SUM((WEEKDAY($E$2:$EE$2,2)=6)*($E4:$EE4)/SUM(1*(WEEKDAY($E$2:$EE$2,2)=6)))

For Sunday I used
Code:
=SUM((WEEKDAY($E$2:$EE$2,2)=7)*($E4:$EE4)/SUM(1*(WEEKDAY($E$2:$EE$2,2)=7)))

Does anyone know what I am doing wrong? I have been playing with it for hours now, and cannot get SAturday to calculate legit averages. Or is there an easier way?

Thank you!
 

Attachments

  • Capture.PNG
    Capture.PNG
    81.9 KB · Views: 5

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
How that function works depends on your regional settings in Windows. Where I am, day one is Sunday, not day 7, and 6 in your second example would be Friday, not Saturday. What day is the leftmost day of any calendar that you use? If it is Sunday, then none of your results are accurate I'd say.
 
Upvote 0
The default may depend on regional settings but the formula explicitly uses 2 for the optional second argument, which specifies Monday=1 -> Sunday=7. This overrides any localization default.
 
Upvote 0
Can you post your actual data for testing? E:EE is a lot of data but maybe you can post part of it. XL2BB is the best way but you could also just copy from Excel and paste into a post.

How are your dates in row 2 entered? Are they all truly Excel date values? For example, when you select G2 what is in the Formula bar?
 
Upvote 0
Can you post your actual data for testing? E:EE is a lot of data but maybe you can post part of it. XL2BB is the best way but you could also just copy from Excel and paste into a post.

How are your dates in row 2 entered? Are they all truly Excel date values? For example, when you select G2 what is in the Formula bar?
Tracking.xlsx
ABCDEFGHIJKLMNOPQ
1ThursdayFridaySaturdaySundayMondayTuesdayWednesdayThursdayFridaySaturdaySundayMondayTuesday
2Interval Start TimeSaturdaySunday 8/29/20248/30/20248/31/20249/1/20249/2/20249/3/20249/4/20249/5/20249/6/20249/7/20249/8/20249/9/20249/10/2024
3AverageAverageAverage
41200-01001.80.02.00131432011323
50100-02001.70.01.53112212211121
60200-03001.90.02.52411111322421
70300-04000.60.00.01020220001000
80400-05001.30.00.54020242001100
90500-06001.40.00.52010211121113
100600-07001.90.12.00211213325304
110700-080010.30.13.01114442812151352711
120800-09006.40.36.58112253585713874
130900-10009.60.730.0874827131061583533118
141000-110010.90.413.514927913698161718149
151100-12008.30.412.05820577111862419310
161200-13009.90.310.011102291331111818111111
171300-14008.70.29.59101091159861310119
181400-150010.80.310.018918715887713131213
191500-160010.70.27.091017813911147461211
201600-170010.70.310.01191391199101117111511
211700-180018.90.18.017201210527171623562619
221800-190015.20.29.019121011116252091271619
231900-200012.30.25.07101261015151017741017
242000-210014.10.113.01510815917281198111612
252100-220023.10.311.513112312711123101210111110
262200-23007.20.15.01314618514421923
272300-24003.90.01.05612144733023
28201.64.2173.0205188284154167168331198172217192193192
29
3057.8%75.6%59.0%35.5%70.8%75.4%54.8%31.4%54.0%59.9%53.5%52.6%65.8%62.5%
Sheet1
Cell Formulas
RangeFormula
B4:B28B4=SUM((WEEKDAY($E$2:$EE$2,2)<6)*($E4:$EE4)/SUM(1*(WEEKDAY($E$2:$EE$2,2)<6)))
C4:C28C4=SUM((WEEKDAY($E$2:$EE$2,2)=6)*($E4:$EE4)/SUM(1*(WEEKDAY($E$2:$EE$2,2)=6)))
D4:D28D4=SUM((WEEKDAY($E$2:$EE$2,2)=7)*($E4:$EE4)/SUM(1*(WEEKDAY($E$2:$EE$2,2)=7)))
A30A30=AVERAGE(E30:Q30)
 
Upvote 0
Sorry hit post before responding. The EE is just to factor in future additions, but I am only what I showed in screenshot far into the spreadsheet. How I have tried testing with Column Q being the end column, which does work for all of them, but any further than columns that have data in them, M-F works and Sunday works, but for some strange reason Saturday breaks. Why only Saturday? lol. The formulas for Saturdays looks same as the other days, that's why its boggling my mind, but I know nothing about the Workday command until today, so figured I was just doing something incorrect.
 
Upvote 0
A blank cell will return 6 for weekday (31/12/1899 was a Saturday apparently), so you'll need to test for those additionally:

Excel Formula:
=SUM((WEEKDAY($E$2:$EE$2,2)=6)*($E4:$EE4)/SUM(1*(WEEKDAY($E$2:$EE$2,2)=6)*($E$2:$EE$2<>"")))
 
Upvote 0
Solution
A blank cell will return 6 for weekday (31/12/1899 was a Saturday apparently), so you'll need to test for those additionally:

Excel Formula:
=SUM((WEEKDAY($E$2:$EE$2,2)=6)*($E4:$EE4)/SUM(1*(WEEKDAY($E$2:$EE$2,2)=6)*($E$2:$EE$2<>"")))
Thank you so much! Wow that was completely random and explains why it was only Saturday that was giving issues!
 
Upvote 0

Forum statistics

Threads
1,221,417
Messages
6,159,789
Members
451,589
Latest member
Harold14

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