Forum Discussion

Lynn McKie's avatar
Lynn McKie
Copper Contributor
Oct 31, 2017

Decimal to date

Hi there hoping someone can help me.

 

I am creating a spreadsheet currently looking at differences in data. However the data i have currently gives ages as 9.2 years (9 years 2 months) but when doing calculations Excel sees it as a decimal and doesn't calculate correctly.

 

for example 9.2 - 8.10 = 0.4 (excel says -1.1)

 

I'm looking for a simple formula to change 9.2 into 9years and 2months on the computer if possible?

 

Hope that makes some sense to somebody.

 

Lynn

3 Replies

  • Hi

    if i get your request right, why dont you convert the decimal into moths first, subtract and convert back?

    for you example

    first split the years from the months

    Years into months=left(9.2,find(".",9.2,1)-1)

    months = mid(9.2,left(9.2,find(".",9.2,1)+1),1)

    and than

    =VALUE(ROUND((9*12+2-8*12+1)/12,0)&"."&MOD(9*12+2-8*12+1,12))=1.3


    Lynn McKie wrote:

    Hi there hoping someone can help me.

     

    I am creating a spreadsheet currently looking at differences in data. However the data i have currently gives ages as 9.2 years (9 years 2 months) but when doing calculations Excel sees it as a decimal and doesn't calculate correctly.

     

    for example 9.2 - 8.10 = 0.4 (excel says -1.1)

     

    I'm looking for a simple formula to change 9.2 into 9years and 2months on the computer if possible?

     

    Hope that makes some sense to somebody.

     

    Lynn





    Lynn McKie wrote:

    Hi there hoping someone can help me.

     

    I am creating a spreadsheet currently looking at differences in data. However the data i have currently gives ages as 9.2 years (9 years 2 months) but when doing calculations Excel sees it as a decimal and doesn't calculate correctly.

     

    for example 9.2 - 8.10 = 0.4 (excel says -1.1)

     

    I'm looking for a simple formula to change 9.2 into 9years and 2months on the computer if possible?

     

    Hope that makes some sense to somebody.

     

    Lynn


     

    • SergeiBaklan's avatar
      SergeiBaklan
      Diamond Contributor

      Hi Yossi,

       

      As a comment

      1) The answer shall be 0.4 (0 years 4 months), not 1.3

      2) Years better to take as INT(A1) even if in A1 is the text like '9.2

      3) And if in source cells are numbers, not text, how do we separate 8 years 1 month and 8 years 10 months

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Hi Lynn,

     

    Please clarify how your initial data is presented. For example, if that's the number 8.1 (which is equal to number 8.10) how do you know that's 8 years and 1 month or 8 years and 10 months? Or you have text here?

Resources