End of month (either current or prior month)

bunfuns

New Member
Joined
Mar 26, 2014
Messages
5
Hi all,

I want to write a formula that returning either the end of month of this month or the prior month.

If a date is already at end of month, then I'll take the date as is. Example: 1/31/14 should return 1/31/14.

If a date is before end of month, I want Excel to give me the end of month from the prior month. Example: 1/15/14 should return 12/31/13.

Was trying to use EOMONTH, but didn't know how to test if a date is already at the end of month.

Thanks,
Susana
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
If your date is in A1 then in B1:
=IF(A1=EOMONTH(A1,0),A1,EOMONTH(A1,-1))
 
Upvote 0
Susana,

Maybe....

Excel 2007
AB
131/01/201431/01/2014
215/01/201431/12/2013
Sheet1
Cell Formulas
RangeFormula
B1=IF(EOMONTH(A1,0)=A1,A1,EOMONTH(A1,-1))


Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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