Wednesday, September 21, 2011

Extract file name from absolute path in Excel


Following formula can be used to get only file name from absolute path in Excel

=RIGHT(A1,LEN(A1)-FIND("~",SUBSTITUTE(A1,"\","~",LEN(A1)-LEN(SUBSTITUTE(A1,"\","")))))

Example

if A1=C:\Vijayan\Dev\qbn\m2\repository\org\apache\ws\security\wss4j\1.5.8\wss4j-1.5.8.jar
then result will be wss4j-1.5.8.jar