Extracting characters from call via Formula..

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
Hey I would like to extract some characters from the cell B26 . I hope it is not much trouble..

B26 = C:\Users\User Name\Desktop\12-2020 (user.name).xlsm

I want to extract 2 characters that comes before "-" which is 12
Then I want to extract 4 characters that comes after "-" which is 2020
I would like to extract the filepath which is C:\Users\User Name\Desktop\

Will appreciate plenty and thanks.

Please note B26 is not consisting of any formula but the value is just giving a filename without the sheet name.
for instance using the code
VBA Code:
Worksheets("HSheet").Range("B26") = ThisWorkbook.FullName
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
If it will always be two characters before the - how about
+Fluff v2.xlsm
BCDE
26C:\Users\User Name\Desktop\12-2020 (user.name).xlsm122020C:\Users\User Name\Desktop\
27
Main
Cell Formulas
RangeFormula
C26C26=MID(B26,FIND("-",B26)-2,2)
D26D26=MID(B26,FIND("-",B26)+1,4)
E26E26=REPLACE(B26,FIND("-",B26)-2,100,"")
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,566
Messages
6,120,257
Members
448,952
Latest member
kjurney

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