0

I'd like to make a custom number format that would split apart a decimal number and take everything to the left and follow that with a Y or Years and take everything to the right, multiply it by 12, and follow that with a M or Months.

TLDR Example:

4.01 would be 4 Y 0 M, 
3.27 would be 3 Y 3 M, 
2.92 would be 2 Y 11 M, 
1.99 needs to be 2 Y 0 M, 
0.45 would be 0 Y 5 M

It doesn't matter if the month carries the decimal value along (it'd be better that way), so long as the value displayed does not contain a value.

If this can't be done in one cell, then that's fine and I wouldn't mind suggestions using multiple cells, but the goal is to tidy this process up so that I can put a formula in a cell that pulls other cell references, so having a single cell with a single custom format would be awesome.

I found two answers coming from two different directions on this here, the only issue is that the first answer would need me to separate my decimal and do the math on the latter half and then concatenate the two together (which would work). I'd go that route if it were necessary, but I was hoping for a way to just use the decimal as is and convert the back half by multiplying it by 12 in the custom format. The second answer was a problem, because I need the cell to be referenced by another cell with it showing as a decimal value to that other cell.

1 Answer 1

0

The format 0"Y" 00/12"M" (the second column) or 0"Y" ?0/12"M" (the third column) can have result similar to your expectation but not the exactly one. See following examples:

4.01    4Y 00/12M   4Y  0/12M
3.27    3Y 03/12M   3Y  3/12M
2.92    2Y 11/12M   2Y 11/12M
1.99    2Y 00/12M   2Y  0/12M
0.45    0Y 05/12M   0Y  5/12M
1
  • That's pretty close. Thanks for the suggestion. I guess I can't do it without having the /12 in there? One other issue with it is that it shows 2.02 as 2 M and 1.99 as 2 M, but it calculates just fine.
    – CSSWormy
    Commented Jul 20, 2016 at 4:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .