Forum Discussion
davidmaddock54
Dec 16, 2021Brass Contributor
Days worked in Month - PQ/M functions possibly
Hi Folks, I am trying to automate a spreadsheet that seems like it should be easy, but there's a hurdle that's tricking me. I don't mind if I have a solution that uses regular excel formulas,...
- 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
tauqeeracma
Dec 16, 2021Iron Contributor
Below formula will give you the desired results:
=IF((AND(B2<(DATE(YEAR($G$1),MONTH($G$1),1)),C2>EOMONTH($G$1,0))),(EOMONTH($G$1,0)-(DATE(YEAR($G$1),MONTH($G$1),1))+1),IF(AND(B2<(DATE(YEAR($G$1),MONTH($G$1),1)),C2<=EOMONTH($G$1,0)),(C2-(DATE(YEAR($G$1),MONTH($G$1),1))+1),IF(AND(B2>=(DATE(YEAR($G$1),MONTH($G$1),1)),C2>=EOMONTH($G$1,0)),(EOMONTH($G$1,0)-B2+0),(C2-B2+0))))
A sample file is also attached for your reference. Hope it will help.
Thanks
Tauqeer