Forum Discussion
Days worked in Month - PQ/M functions possibly
- Dec 16, 2021
davidmaddock54 As a variant, using the example kindly provided by tauqeeracma , try this:
=MIN($G$1,C2)-MAX(EDATE($G$1,-1)+1,B2)+1
davidmaddock54 As a variant, using the example kindly provided by tauqeeracma , try this:
=MIN($G$1,C2)-MAX(EDATE($G$1,-1)+1,B2)+1
- Riny_van_EekelenDec 17, 2021Platinum Contributor
davidmaddock54 It isn't all that magical. Dates in Excel are in fact sequential numbers, starting at 1 for January 1, 1900.
So, with your problem the end date should not be after July 31 (i.e. minimum value of July 31 and the end date) and the start date should not be before July 1 (i.e. maximum value of July 1 and the start date). You can use the MIN and MAX functions for that. The EDATE function comes in to "calculate" the first day of the month, based on the given end date, but you could aslo enter the start date into its own cell and refer directly to that one.
- davidmaddock54Dec 17, 2021Brass ContributorAnd it works a treat. Added an IF formula as I needed cells to stay blank if data was incomplete and we're set. Thank you all.