no analysis toolpak

Emjaye

Board Regular
Joined
Oct 3, 2003
Messages
89
Hi all.

I found the perfect solution to my problem - identifying the last Sunday of a month - by using the formula
Code:
INT((EOMONTH(L1,0)-1)/7)*7+1
making use of the analysis toolpak

Our inglorious I.T dept did an upgrade this week and took the add-in's out of excel and are unlikely to put them back because
" it's not in our remit "
however I could always make a business case to have them installed (aaaaaaaaaaarrrrrrrrrrrrrgh!)

Now, past experience has shown that getting a business case passed has about as much chance as you and me seeing seahorses flying broomsticks to Mars, therefore I am looking for an alternative method, that does not need an add-in

please :)
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Certainly not as elegant as the EOMONTH version...
but, try this regular formula:
Code:
=L1-DAY(L1)+MAX(DAY(L1+1-WEEKDAY(L1+1-7,2)+7*{1;2;3;4;5}))
Does that help?
 
Upvote 0
Or another

=DATE(YEAR(A1),MONTH(A1)+1,0)+1-WEEKDAY(DATE(YEAR(A1),MONTH(A1)+1,0))
 
Upvote 0
Certainly not as elegant as the EOMONTH version...
but, try this regular formula:
Code:
=L1-DAY(L1)+MAX(DAY(L1+1-WEEKDAY(L1+1-7,2)+7*{1;2;3;4;5}))
Does that help?
If the date in L1 is >= the date of the last Sunday then that formula fails.
 
Upvote 0
You could perhaps fix that with this version along the same lines.....

=L1-DAY(L1)+MAX(DAY(L1-DAY(L1)+1-WEEKDAY(L1-DAY(L1))+7*{4;5}))

I note that the original formula with EOMONTH doesn't work if you are using 1904 date system......but assuming that's not an issue then this version will also work

=FLOOR(L1-DAY(L1)+31-DAY(L1-DAY(L1)+32),7)+1
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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