Simplify an excel formula

kitty_el

New Member
Joined
Feb 22, 2023
Messages
2
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hi, I am wondering if anyone can help me simplify an excel formula. The formula works fine but it’s quite long. I can’t think of another way to write it. The formula is:

=IF((EOMONTH(I3,0)-MOD(WEEKDAY(EOMONTH(I3,0))+1,7)-4)<4=EOMONTH(I3,0),EOMONTH(I3,0)-MOD(WEEKDAY(EOMONTH(I3,0))+1,7)-4,EOMONTH(I3,0)-WEEKDAY(EOMONTH(I3,0)-2))

The formula is working out which Monday is the best to return (last or 2nd to last) depending on how close it is to the last Friday of the month

Hope this makes sense
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
That formula does not work. The 1st part (EOMONTH(I3,0)-MOD(WEEKDAY(EOMONTH(I3,0))+1,7)-4)<4=EOMONTH(I3,0) will always return FALSE so this part EOMONTH(I3,0)-MOD(WEEKDAY(EOMONTH(I3,0))+1,7)-4 will never be calculated.

Also the last Monday will always be closest to the Friday, so do you just want the last Monday?
If so just use
Excel Formula:
=WORKDAY.INTL(EOMONTH(I3,0)+1,-1,"0111111")
 
Upvote 0
Having had another look at your formula, I think that all you need is
Excel Formula:
=EOMONTH(I3,0)-MOD(WEEKDAY(EOMONTH(I3,0))+1,7)-4
 
Upvote 0

Forum statistics

Threads
1,221,525
Messages
6,160,329
Members
451,637
Latest member
hvp2262

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