Remove characters from a file name

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
660
Office Version
  1. 2019
Platform
  1. Windows
Hello,
How to remove characters from beginning of a file in a certain folder?
I can identify the folder from a cell. (myPath="A1")
File Name (example):
07. White Knuckles.mp3
07 White Knuckles.mp3
7 White Knuckles.mp3

Maybe removing from the first space and backwards?
Thank you.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
You could try
=REPLACE(A2,1,FIND(CHAR(160),A2),"")
If that doesn't work you will need to let us know what Rick's formula in post#10 returns.
 
Upvote 0
Did my formula work or not? I am guessing not given the result you got from Fluff's formula. With Sheet1 active, put this formula in an empty cell and tell us what it displays...

=CODE(MID(A2,2,1))
The first formula works, the second returns numbers. Here are the results.
Replace Files.xlsm
AB
1Old File NameNew File Name
21 Intro.mp3Intro.mp3
302. Under And Over It.mp3Under And Over It.mp3
403. Burn It Down.mp3Burn It Down.mp3
504. American Capitalist.mp3American Capitalist.mp3
605. Hard To See.mp3Hard To See.mp3
706. Coming Down.mp3Coming Down.mp3
807. Bad Company.mp355
908. White Knuckles.mp356
1009. Drum Solo.mp357
1110. Far From Home.mp348
1211. Never Enough.mp3#VALUE!
1312. War Is The Answer.mp3#VALUE!
1413. Remember Everything.mp3#VALUE!
1514. No One Gets Left Behind.mp3#VALUE!
1615. The Bleeding.mp3#VALUE!
Sheet1
Cell Formulas
RangeFormula
B2:B7B2=MID(A2,FIND(" ",A2)+1,999)
B8:B11B8=CODE(MID(A8,2,1))
B12:B16B12=REPLACE(A12,1,FIND(" ",A12),"")
 
Upvote 0
Here are the results of 4 formulas:
Replace Files.xlsm
AB
1Old File NameNew File Name
21 Intro.mp3Intro.mp3
302. Under And Over It.mp3Under And Over It.mp3
403. Burn It Down.mp3Burn It Down.mp3
504. American Capitalist.mp3American Capitalist.mp3
605. Hard To See.mp3Hard To See.mp3
706. Coming Down.mp3Coming Down.mp3
807. Bad Company.mp355
908. White Knuckles.mp356
1009. Drum Solo.mp357
1110. Far From Home.mp348
1211. Never Enough.mp3#VALUE!
1312. War Is The Answer.mp3#VALUE!
1413. Remember Everything.mp3#VALUE!
1514. No One Gets Left Behind.mp3#VALUE!
1615. The Bleeding.mp3#VALUE!
Sheet1
Cell Formulas
RangeFormula
B2:B7B2=MID(A2,FIND(" ",A2)+1,999)
B8:B11B8=CODE(MID(A8,2,1))
B12:B14B12=REPLACE(A12,1,FIND(CHAR(160),A12),"")
B15:B16B15=REPLACE(A15,1,FIND(" ",A15),"")
 
Upvote 0
If Rick's formula works, then use that. :)
Although I don't understand how his works & mine doesn't.
 
Upvote 0
Did my formula work or not? I am guessing not given the result you got from Fluff's formula. With Sheet1 active, put this formula in an empty cell and tell us what it displays...

=CODE(MID(A2,2,1))
I'm trying to put this formula in a macro but receive this error:
1594045758933.png
 
Upvote 0
You need to double-up the quotes inside the formula like
"=MID(A2,FIND("" "",A2)+1,999)"
 
Upvote 0
Yes. It works. Thank you.
Here are the results:
Replace Files.xlsm
AB
1Old File NameNew File Name
21 Intro.mp3Intro.mp3
302. Under And Over It.mp3Under And Over It.mp3
403. Burn It Down.mp3Burn It Down.mp3
504. American Capitalist.mp3American Capitalist.mp3
605. Hard To See.mp3Hard To See.mp3
706. Coming Down.mp3Coming Down.mp3
807. Bad Company.mp3Bad Company.mp3
908. White Knuckles.mp3White Knuckles.mp3
1009. Drum Solo.mp3Drum Solo.mp3
1110. Far From Home.mp3Far From Home.mp3
1211. Never Enough.mp3Never Enough.mp3
1312. War Is The Answer.mp3War Is The Answer.mp3
1413. Remember Everything.mp3Remember Everything.mp3
1514. No One Gets Left Behind.mp3No One Gets Left Behind.mp3
1615. The Bleeding.mp3The Bleeding.mp3
Sheet1
Cell Formulas
RangeFormula
B2:B16B2=MID(A2,FIND(" ",A2)+1,999)
 
Upvote 0

Forum statistics

Threads
1,216,106
Messages
6,128,863
Members
449,473
Latest member
soumyahalder4

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