Convert a duration to years, months, and days in numbers.
Solved
cece0403
-
cece0403 -
cece0403 -
Hello,
I want to convert service times provided in years, months, and days into a number of days to automatically calculate an average service based on different criteria.
Example:
2 year(s) 1 month 12 days = 773
Configuration: Windows 7 / Internet Explorer 9.0
I want to convert service times provided in years, months, and days into a number of days to automatically calculate an average service based on different criteria.
Example:
2 year(s) 1 month 12 days = 773
Configuration: Windows 7 / Internet Explorer 9.0
Liens connexes:
- Excel - Conversion days >> years, months, days
- date in excel but only day and month without considering the year
- Excel: Convert a negative number to positive
- Convert hours to months-days-hours
- convert quarters to years months and days
- Conversion de cellule avec le mois en chiffres en mois en lettres
5 réponses
Hello, would you like software that automatically calculates 2 years, 1 month, and 12 days?
--
In terms of IT
Aubinus
--
In terms of IT
Aubinus
A conversion will never be accurate.
It would be wise to work from the start date and the end date, which allows the use of the DATEDIF function that takes into account months of 28, 30, and 31 days, and leap years, in particular...
--
It's great, retirement! Especially in the Caribbean... :-)
Raymond (INSA, AFPA, CF/R)
It would be wise to work from the start date and the end date, which allows the use of the DATEDIF function that takes into account months of 28, 30, and 31 days, and leap years, in particular...
--
It's great, retirement! Especially in the Caribbean... :-)
Raymond (INSA, AFPA, CF/R)
Hello Cece
To extract numbers from a cell, multiply them by the number of days and add them all up, the formula for a service time in B4 is:
=LEFT(B4,FIND(" ",B4)-1)*365 + MID(B4,FIND(")",B4)+2,2)*30 + MID(B4,FIND("j",B4)-3,2)*1
Best regards
Via
--
"Imagination is more important than knowledge." A. Einstein
To extract numbers from a cell, multiply them by the number of days and add them all up, the formula for a service time in B4 is:
=LEFT(B4,FIND(" ",B4)-1)*365 + MID(B4,FIND(")",B4)+2,2)*30 + MID(B4,FIND("j",B4)-3,2)*1
Best regards
Via
--
"Imagination is more important than knowledge." A. Einstein
Hello via55, thank you for these elements. When I enter the entire formula, it doesn't work (#value). However, if I only enter the beginning of the formula, it calculates the years correctly. But if I use the same formula possibly in another column for the months and then for the days, it doesn’t work.
```html
anj = inputbox ("Combien d'années")
mj = inputbox ("Combien de mois")
jj= inputbox ("Combien jour")
tja = anh*365
tjm = mj*30
tj= jj + tja + tjm
msgbox " " & tj & " "
Met ça dans un bloc note que tu renommes en .vbs.
Pour l'instant il donne un nombre approximatif du temps en jours mais je vais l’améliorer pour qu'il donne un temps dont tu pourras choisir l'unité de mesure (mois, jours, heures, minutes, secondes) et qui sera exact.
--
Informatiquement
Aubinus ```
mj = inputbox ("Combien de mois")
jj= inputbox ("Combien jour")
tja = anh*365
tjm = mj*30
tj= jj + tja + tjm
msgbox " " & tj & " "
Met ça dans un bloc note que tu renommes en .vbs.
Pour l'instant il donne un nombre approximatif du temps en jours mais je vais l’améliorer pour qu'il donne un temps dont tu pourras choisir l'unité de mesure (mois, jours, heures, minutes, secondes) et qui sera exact.
--
Informatiquement
Aubinus ```