• 594K Members
• 8,689 Online
• 722K Conversations
SOLVED

Highlighted
New Contributor

# Convert string to number of days

Please share excel formula to convert- "

 1 years 0 months 22 days = "387" days

5 Replies
Highlighted

# Re: Convert string to number of days

@arjsharm I guess it depends which year you are talking about. Some years have 364 days, some have 365 days. So, it will be either 365 + 22 or 364 + 22.

Highlighted
Solution

# Re: Convert string to number of days

Hello @arjsharm,

If "years", "months", and "days" are in the same cell such as "1 years 0 months 22 days" then that could be:

`=SUM(365*LEFT(A1,FIND(" y",A1)-1),365/12*MID(A1,FIND("rs",A1)+3,FIND(" m",A1)-FIND("rs",A1)-3),--MID(A1,FIND("hs",A1)+3,FIND(" d",A1)-FIND("hs",A1)-3))&" days"`

If "years", "months", and "days" are in the separate cells such as

 Years Months Days 1 0 22

Then that could be:

`=A1*365+B1*365/12+C1&" days"`
Highlighted

# Re: Convert string to number of days

@Riny_van_Eekelen in my case the year is 365 days irrespective of leap year days

Highlighted

# Re: Convert string to number of days

@PReagan Thanks for sharing the formula ! It worked!

Highlighted

# Re: Convert string to number of days

My pleasure!

Related Conversations