Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
1  
For anyone that's looking how to to this in Google Spreadsheet, you can use REGEXEXTRACT(A1, "\.([^.]*)$") – Joe Aug 9 '15 at 9:21
up vote 15 down vote accepted
=REPLACE(RIGHT(A1,5),1,SEARCH(".",RIGHT(A1,5)),"")

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

share|improve this answer
    
Thanks Cyril. Your math is brilliant! – Nam G VU May 17 '10 at 9:04
1  
Note that this only works for file extensions that are four characters or shorter. – Tim Robinson Mar 21 '13 at 16:26
    
You can just change the 5 to a 6 or whatever, right? – Devil's Advocate Mar 11 '15 at 14:45
    
Nope, that causes issues. – Devil's Advocate Mar 11 '15 at 15:11

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

=RIGHT(A1,LEN(A1)-FIND("|",SUBSTITUTE(A1,".","|",LEN(A1)-LEN(SUBSTITUTE(A1,".","")))))
share|improve this answer
    
works a treat! Thanks for the quick copy/paste solution. Works for file extensions with 2 to 7 character file extensions with full paths and namespaces notation in filename. – Zephan Schroeder Jul 21 '15 at 6:01

Assuming you have nicely formatted extensions, you can do this quickly as =RIGHT(A1,3). A more robust solution would find the index of the rightmost . and then extract the remaining characters.

share|improve this answer
    
Reading your question that is the answer I would have given. – VerGuy May 17 '10 at 6:59
    
I think the real question here is: how to find the rightmost "." in Excel. – petersohn May 17 '10 at 7:06
    
The extension is not alsway in 3 characters. @pertersohn: Yeah, you're right. – Nam G VU May 17 '10 at 8:58

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

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .