Date Formulas with IF ?

EMY245

New Member
Joined
Aug 6, 2013
Messages
20
Hello,

I was wondering if someone can help me in creating a formula based on dates.

I need the formula to be able to tell me the month of a set date depending on the day of the month. The criteria is: If the start is after 1st of the month, populate the following month, if not use the current. If the end date is after the 1st use the current month, if not use the prior month. Examples below - i need the formula in 'start month' and 'end month' fields.

I have tried without using the start / end month fields and just using the active months fields with the formula =IF(DAY(B11)>1,DATEDIF(B10,B11,"m")+(DATEDIF(B10,B11,"md")>0)+1,DATEDIF(B10,B11,"m")) but this does not seem to work. The main field i need is the "active months"

Thank you in advance!

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Start Date[/TD]
[TD]4 January 2018[/TD]
[/TR]
[TR]
[TD]End Date[/TD]
[TD]16 April 2018[/TD]
[/TR]
[TR]
[TD]Start Month[/TD]
[TD]February[/TD]
[/TR]
[TR]
[TD]End Month[/TD]
[TD]April[/TD]
[/TR]
[TR]
[TD]Active Months[/TD]
[TD]3[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
This?


Excel 2010
AB
1Start Date4-Jan-18
2End Date16-Apr-18
3Start MonthFebruary
4End MonthApril
5Active Months3
Sheet5
Cell Formulas
RangeFormula
B3=TEXT(IF(DAY(B1)>1,EOMONTH(B1,1),B1),"mmmm")
B4=TEXT(IF(DAY(B2)>1,B2,EOMONTH(B2,-1)),"mmmm")
B5=1+MONTH(B4&1)-MONTH(B3&1)


=DATEDIF(B1,B2,"m") gives you 3 here but may not under irregular conditions.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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