View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Finding position of last period in filename

On Mon, 28 Mar 2011 22:37:18 -0400, "Rick Rothstein" wrote:

B1:
=LEFT(A1,FIND(CHAR(1),SUBSTITUTE(A1,".",CHAR(1),LE N(A1)-LEN(SUBSTITUTE(A1,".",""))))-1)

C1: =TRIM(RIGHT(SUBSTITUTE(A1,".",REPT(" ",99)),99))


Perhaps, since we know what C1 will contain, this simpler formula for B1...

B1: =SUBSTITUTE(A1,"."&C1,"")

Rick


I don't like that because it fails if the suffix happens to also exist within the first part of the extract.

e.g.:

A1: This.is.the.DOCument.filename.DOC