Solved

# Months extract from formula

Posted on 2011-09-14
247 Views
Experts:

I need to modify this formula to return Months instead of the number of days.
How can I do this?

=IF(GTExpireDate<FacilityExpirationDate,SUM(MID(\$D\$15,SEARCH({"mon","day"},\$D\$15)-3,2)*{30,1}),"Expires After Facility Expiration")

ie it returns "60" for the number of days but I need it to return 2 months.

thank you
0
Question by:pdvsa
• 2
• 2

LVL 50

Accepted Solution

barry houdini earned 250 total points
ID: 36536790
If you want to ignore the days and just take months try this version

=IF(GTExpireDate<FacilityExpirationDate,MID(\$D\$15,SEARCH("mon",\$D\$15)-3,2)+0,"Expires After Facility Expiration")

regards, barry
0

LVL 10

Assisted Solution

Tony Barkdull earned 250 total points
ID: 36536792
Just divide by 30...

=IF(GTExpireDate<FacilityExpirationDate,SUM(MID(\$D\$15,SEARCH({"mon","day"},\$D\$15)-3,2)*{30,1}/30),"Expires After Facility Expiration")

0

Author Comment

ID: 36536901
it might be better to look at the file.

What I need is the remainder in months on row 36.

should be 2.

thank you
LC-Costs.xls
0

LVL 50

Expert Comment

ID: 36537037
Did you try the formula I gave? That should give the result 2 - it just extracts the month figure from D15. What result would you want if the value in D15 was 4 years 2 months 20 days?

tbarkdull's suggestion will give you a fraction, e.g. 2.67, mine will still give you 2 - what should it be, either of those or something else?

regards, barry
0

Author Closing Comment

ID: 36538107
I am not sure which one at the moment.  Sorry got a little sidetracked with new job.

thank you for the help.
0

## Featured Post

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.