tags:

views:

22

answers:

1

Hi,

dadasdf\sdasdasd\qazxbbjj\test.txt

Above is the string in cell A1 in excelsheet,I want to extract the last word from that cell.i.e,I want only test.txt,How can I acchive that using excel function.If it is acchived by declaring any variable then also help me out.

+1  A: 

Its clunky w/ a formula so you can do it with VBA.

To a module add;

Function GetFileName(Cell As Range)
  GetFileName = Mid(Cell.Value, 1 + InStrRev(Cell.Value, "\"))
End Function

then in the cell you can =GetFileName(A1)

Alex K.