本帖最后由 hjj0451 于 2012-10-26 14:07 编辑
几种方法都未能取得简洁的效果,先列出来,看能不能找到更好的办法:
法一,复数法,226:
- =TEXT(INT(IMREAL(IMPRODUCT(IMSUM(SUBSTITUTE(TEXT(SUBSTITUTE(0&B2:F2,"h",),"0+0")&"i","d","+0")),"8-i"))/8),"0\d;;")&SUBSTITUTE(MOD(IMAGINARY(IMSUM(SUBSTITUTE(TEXT(SUBSTITUTE(0&B2:F2,"h",),"0+0.0")&"i","d","+0"))),8)&"h","0h",)
复制代码 法二,分数法,271:
- =SUBSTITUTE(TEXT(INT(SUM(COUNTIF(B2:F2,"*.5h")/80+SUBSTITUTE(TEXT(SUBSTITUTE(SUBSTITUTE(0&B2:F2,".5",),"h",),"0 0")&"/8","d"," 0"))),"0\d;;")&MOD(SUM(8*SUBSTITUTE(TEXT(SUBSTITUTE(SUBSTITUTE(0&B2:F2,".5",),"h",),"0 0")&"/8","d"," 0"))+COUNTIF(B2:F2,"*.5h")/2,8)&"h","0h",)
复制代码 185:
- =SUBSTITUTE(SUBSTITUTE(TEXT(SUM(MID(SUBSTITUTE(TEXT(SUBSTITUTE(0&B2:F2,"h",),"0 0.0"),"d"," 0"),{1;5},{4;9})/{1;8})-1%,"#\d0/8;"),"/8",RIGHT(".5h",2--1^COUNTIF(B2:F2,"*.5h"))),"0h",)
复制代码 "*.5h"应该可以改为"*.*"省1字符,如果原始数据没有1.0h这样的格式的话。
法三,直接法,190:
- =SUBSTITUTE(TEXT(INT(SUM(ISNUMBER(MATCH("*d"&ROW(A:A)/{1,2}&{"d*","h*"},"d"&B2:F2,))*ROW(A:A)/{1,16})),"0\d;;")&MOD(SUM(ISNUMBER(FIND("d"&ROW(A:A)/2&"h","d"&B2:F2))*ROW(A:A))/2,8)&"h","0h",)
复制代码 用MATCH在重复值处理时存在问题:
还是用FIND,211:
- =SUBSTITUTE(TEXT(INT(SUM((1-ISERR(FIND(0&ROW(A:A)&"d",0&B2:F2))+ISNUMBER(FIND("d"&ROW(A:A)/2&"h","d"&B2:F2))/16)*ROW(A:A))),"0\d;;")&MOD(SUM(ISNUMBER(FIND("d"&ROW(a:a)/2&"h","d"&B2:F2))*ROW(a:a))/2,8)&"h","0h",)
复制代码 试一下文本分段处理法,198:- =SUBSTITUTE(TEXT(INT(SUM(MID(SUBSTITUTE(TEXT(SUBSTITUTE(0&B2:F2,"h",),"0 0"),"d"," 0"),{1;7},6)/{1;8})),"0\d;;")&MOD(SUM(ISNUMBER(FIND("d"&ROW(A:A)/2&"h","d"&B2:F2))*ROW(A:A))/2,8)&"h","0h",)
复制代码 8个" ",前半部分长度同复数法。
法四,时间法,165:
- =SUBSTITUTE(TEXT(SUM(TEXT(SUM(ISNUMBER(MATCH("*d"&ROW(A:A)/{1,2}&{"d*","h*"},"d"&B2:F2,))*ROW(A:A)/{6,96}/240),{"[m]","s.00"})%/{14.4,6480}),"[m]\ds.0\h;;"),"0.0h",)
复制代码 还差od没有处理掉,同时MATCH在重复值处理时也存在问题:- =SUM(TEXT(SUM(TEXT(SUM(--("0:"&SUBSTITUTE(TEXT(SUBSTITUTE(B2:F2,"h",),"0\:0.0"),"d",":0"))),{"[m]","s.0"})/{6,48}/240),{"[m]","s.0"})%/{14.4,6480})
复制代码 超出嵌套,需要自定义格式[m]\ds.0\h;;。
做的好纠结,可能走弯路了。 |