File Extension Remover

binar

Board Regular
Joined
Aug 20, 2006
Messages
71
Fellow Forum Members,
I have a list of files that require I remove all file extensions (including the period)

I would be very grateful if some one out there could help combine both formulas shown below into a single conditional IF statement formula:

=LEFT(F12,LEN(F12)-5)

=LEFT(F12,LEN(F12)-4)


The result I'm seeking handles removing both 4 and 5 character extensions. For example:

IF file extension = .mpeg or .divx , etc... use this formula "=LEFT(F12,LEN(F12)-5)"

OTHERWISE

IF file extension = .avi or .mov or .wmv or .mpg , etc... use this formula "=LEFT(F12,LEN(F12)-4)"


Any help will be greatly appreciated. Thank you very much.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Another shot (in case a . is in the filename too):
=LEFT(A1,LEN(A1)-LEN(TRIM(RIGHT(SUBSTITUTE(A1,".",REPT(" ",100)),100)))-1)
 
Upvote 0
Try

=LEFT(F12,FIND(".",F12)-1)

VoG and xenou,
Thanks for your replies. Since I am a newbie I am steering towards the least complicated option that VoG posted.

VoG, if it is not too much trouble can you explain what the "-1" is about. It seems to have no connection to -4 or -5 from the formulas I posted. Thanks
 
Upvote 0
The Find statement locates the position of . in the filename. We subtract 1 since we don't want the . then use LEFT to extract the part that you want.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top