开发者

Excel formula to pull the second and third word from a filename?

I need a forumula to pull only the second and third word from a filename. The formatting goes like this: "120610 CHELSEA OPTICS.xls". I need a formula so that "CHEL开发者_JAVA技巧SEA OPTICS" will only appear in the cell, without the date in front or the file type in back. I've tried to find this, but haven't found some formula that can remove both the date in front and the file type. Please help!


How about:

=MID(A1,8,LEN(A1)-12)

This supposes that the date is always 6 digits and the file type always 3 characters.

The file name of the current workbook minus the path and extension is:

=MID(CELL("filename"),FIND("[",CELL("filename"))+1,(FIND(".",CELL("filename"))-FIND("[",CELL("filename")))-1)

As you can see, it is getting quite complicated, but changing 1 to 8 on both sides should get you the part you want:

=MID(CELL("filename"),FIND("[",CELL("filename"))+8,(FIND(".",CELL("filename"))-FIND("[",CELL("filename")))-8)

It might be easier to use a User Defined Function, depending on your security settings.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜