简体   繁体   English

在Excel中将年份月份组合添加为小数

[英]Add year month combination as decimals in excel

i have an excel sheet with values in a column as 1.11 which implies it is 1 year and 11 months. 我有一个Excel表格,其列中的值为1.11,这意味着它是1年11个月。 I want to add these values and get the result in year terms - for example 1.11 + 2.1 should be equal to 4 and not 3.31. 我想添加这些值并以年为单位获取结果-例如1.11 + 2.1应该等于4而不是3.31。

Any help is greatly appreciated. 任何帮助是极大的赞赏。

Name    Total_Time_spent    
A   1.11
B   2.1 
C   0.3
D   0.5

When i add i get 4.01 however i want to get 4.8 which implies it is four years eight months. 当我加上4.01时我想得到4.8,这意味着它是四年八个月。

You will need to parse it as if it were a text string and add the parts back together to get what you want: 您将需要解析它,就像它是文本字符串一样,然后将各个部分重新加在一起以得到所需的内容:

=--(SUMPRODUCT(--LEFT(B1:B4,FIND(".",B1:B4)-1))+INT(SUMPRODUCT(--MID(B1:B4,FIND(".",B1:B4)+1,2))/12)&"." &MOD(SUMPRODUCT(--MID(B1:B4,FIND(".",B1:B4)+1,2)),12))

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM