How to get file extension in MS Excel?

I have a column containing file paths. I want to make another column which contain the extensions of the paths only. How can I do this in Microsoft Excel?


=REPLACE(RIGHT(A1,5),1,SEARCH(".",RIGHT(A1,5)),"")

This formula wil be useful if you have more than one dot in filename


Taken from another answer (changed to look for dots and not spaces):

=RIGHT(A1,LEN(A1)-FIND("|",SUBSTITUTE(A1,".","|",LEN(A1)-LEN(SUBSTITUTE(A1,".","")))))

Cyril answer works only if the extension is 3 or 4 characters and user273281 answer did not work when there were . (periods) in file name.

Hence I figured out a new way of achieving this,

=TRIM(RIGHT(SUBSTITUTE(TRIM(A1), ".", REPT(" ", LEN(TRIM(A1)))), LEN(TRIM(A1))))

Note : user273281's aswer did not work for the case where file name was 1. Macro based file.zip . It returns . Macro based file.zip