Help with IF Statement using dates

Mldeuser

Well-known Member
Joined
Dec 27, 2008
Messages
574
Office Version
  1. 365
Platform
  1. Windows
I am trying to write an IF statement where if cell G1 = 1st day of the month and cell H1 = the last day of the month then do the following otherwise go to the next if statement.

My problem is how to account for months ending on the 28th 29th for leap year the 30th and the 31st.

Any suggestions would be greatly appreciated.

Thank you
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I am trying to write an IF statement where if cell G1 = 1st day of the month and cell H1 = the last day of the month then do the following otherwise go to the next if statement.

My problem is how to account for months ending on the 28th 29th for leap year the 30th and the 31st.

Any suggestions would be greatly appreciated.

Thank you
Try something like this...

Assuming the cells will contain dates only (or they could be empty).

=IF(AND(DAY(G1)=1,H1=EOMONTH(G1,0)),...

Note that the EOMONTH function requires the Analysis ToolPak add-in be
installed if you're using a version of Excel prior to Excel 2007. If you enter the formula and get a #NAME? error look in Excel help for the EOMONTH
function. It'll tell you how to fix the problem.
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,448
Members
452,915
Latest member
hannnahheileen

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