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!

Start Date4 January 2018
End Date16 April 2018
Start MonthFebruary
End MonthApril
Active Months3

<tbody>
</tbody>
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

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