View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jack Deuce Jack Deuce is offline
external usenet poster
 
Posts: 30
Default Finding position of last period in filename

On Tue, 29 Mar 2011 07:14:53 -0400, Ron Rosenfeld
wrote:

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


Both solutions work perfectly. Thanks again.