在Excel中从文件名修剪扩展名 [英] triming extension from filename in Excel
问题描述
例如,
abcdefgh.pdf = TRIM(LEFT(A1,LEN(A1)-4))给出abcdefgh
xyz.xlsx = TRIM(LEFT(A2,LEN(A2)-4))给出xyz。
有没有一个公式来查找最后一个点,并在最后一个点之后修剪所有内容?
p>尝试这个公式来摆脱最后一个点和
= LEFT(A1,LOOKUP(2 ^ 15,FIND( 。,A1,ROW(INDIRECT(1:& LEN(A1))))) - 1)
只有一个点,根据你的例子,那么你只需要
= LEFT(A1,FIND(。,A1)-1) / code>
I have this formula. This works great but fails when there are 5 characters including the dot.
For example,
abcdefgh.pdf =TRIM(LEFT(A1,LEN(A1)-4)) gives me abcdefgh xyz.xlsx =TRIM(LEFT(A2,LEN(A2)-4)) gives me xyz.
Is there a formula that looks for the last dot and trims everything after the last dot?
Try this formula to get rid of the last dot and everything after
=LEFT(A1,LOOKUP(2^15,FIND(".",A1,ROW(INDIRECT("1:"&LEN(A1)))))-1)
If there's only ever one dot as per your examples then you only need
=LEFT(A1,FIND(".",A1)-1)
这篇关于在Excel中从文件名修剪扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!