Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

triming extension from filename in Excel

Tags:

trim

excel

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?

like image 291
torres Avatar asked Dec 06 '22 08:12

torres


1 Answers

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)

like image 115
barry houdini Avatar answered Dec 24 '22 08:12

barry houdini