Weekday Serial Number

Falcons88

New Member
Joined
Jun 10, 2021
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am trying to count how many days are between two date for various work patterns, I am trying to create a formula which will change the serial number of weekday based on a work pattern, the below example is a section of my formula that works but I'm trying to advance it:

WEEKDAY((IF($B$3<DATE(YEAR($B$4),1,1),DATE(YEAR($B$4),1,1),$B$3))-{2,3})

I am wanting the 2 (Monday) and 3 (Wednesday) to change so if I have cell in A1 that is 4 (Thursday) and another cell in B1 that is 5 (Friday) based on certain work patterns it will change to the below formula

WEEKDAY((IF($B$3<DATE(YEAR($B$4),1,1),DATE(YEAR($B$4),1,1),$B$3))-{A1, B1})

when I do this it errors, is there a way the formula can recognise just the numbers like in the 1st formula?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
How about
Excel Formula:
=WEEKDAY((IF($B$3<DATE(YEAR($B$4),1,1),DATE(YEAR($B$4),1,1),$B$3))-CHOOSE({1,2},A1,B1))
 
Upvote 0
How about
Excel Formula:
=WEEKDAY((IF($B$3<DATE(YEAR($B$4),1,1),DATE(YEAR($B$4),1,1),$B$3))-CHOOSE({1,2},A1,B1))
Hi Fluff,

This does work and thank you.
I current have my work patterns set out below, so if for example T2, doesn't work Sunday so its blank (or 0) then it errors, if its then it calculates it incorrectly, maybe I'm over complicating the process?
Essentially I'm trying to pull out a figure telling me how many days in a given month in the year people work based on their work pattern to then work out annual leave days so i have some people working 5 days, some 4 ,some 3 etc, but someone could work 3 days mon-wed and another person could work wed-fri so a lot of variables

1639054342197.png
 
Upvote 0
There is no point in using choose when you only have one value to choose from, also the use of INT is pointless, as weekday returns an integer.
Does T2 contain a formula that returns ""
 
Upvote 0
There is no point in using choose when you only have one value to choose from, also the use of INT is pointless, as weekday returns an integer.
Does T2 contain a formula that returns ""
Yeah it just put it in there as a trial to see if it worked as 0 wasn't doing it right, do you have a suggestion where i could do this a simpler way?
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

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