[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Extract # of Years from Date formula

Posted on 2011-02-21
4
Medium Priority
?
225 Views
Last Modified: 2012-05-11
Experts,
I have this formula:
=YearsMonthsDays($A$8,$C$8,$D$4,$D$5)

and it returns X Years, Y Months and Z Days

I need to incorporate the # of Years into a formula I am using
How can I extract the Years from the YearsMonthsDays formula?

Lets say that the YearsMonthsDays = 10 years and 5 months and 10 days...I would want the answer to be 10 only and no fraction of years.

I hope this makes sense...please ask if need additional information.
0
Comment
Question by:pdvsa
  • 2
4 Comments
 
LVL 50

Expert Comment

by:Dave Brett
ID: 34947278
It isn't an inbuilt formula, it is a User Design Function (UDF)

Can you please post the code that sits behind this UDF

Cheers

Dave
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 2000 total points
ID: 34947315
Like your other question you could extract that from the result, so if you have this text in B2

10 years and 5 months and 10 days

you can get the years with

=LEFT(B2,FIND(" ",B2)-1)+0

regards, barry
0
 

Author Closing Comment

by:pdvsa
ID: 34947342
thanks Barry...   Yes, it was not a UDF, which was a good question to ask and I failed to mention that.  I really forgot that is was not a UDF.
0
 
LVL 50

Expert Comment

by:Dave Brett
ID: 34947403
Assuming it was a UDF you would be better off tweaking the UDF function internally for a direct answer rather than manipulating the output

For example you can use an Optional variable to dictate years only

Cheers

Dave
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
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 demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question