How to replace/delete all charaters that appear after '/'

jnathan

New Member
Joined
Jul 8, 2013
Messages
48
I have a spreadsheet showing variable strings however I want to remove all character that appear after / e.g
'Virgin Islands/123/7 H %' should appear as just 'Virgin Islands'.

The strings and the characters after the '/' are variable in length so the replace function using '/????' will not work for everything.

Does anyone have a solution for this? Any help will be greatly appreciated!

Many thanks

Justin :)
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
If the format is the same where it begins with a ' and ends with a '

Using the formula VoG used but add in the RIGHT so it shows the '

=LEFT(A13,FIND("/",A13)-1)&RIGHT(A13,1)
 
Upvote 0
When I first read the OP I thought you wanted to remove everything within the /'s

=LEFT(A13,SEARCH("/",A13,1)-1)&" "&RIGHT(A13,(LEN(A13)-FIND("/",A13,FIND("/",A13)+2)))
 
Upvote 0
The strings and the characters after the '/' are variable in length so the replace function using '/????' will not work for everything.
If you still wanted to use the Replace dialog box (instead of a formula solution), just use '/*' (that is, a slash followed by an asterisk) instead of '/????' in the "Find what" field (with the "Replace with" field being empty)... the asterisk is a wildcard for "zero or more characters". Also, make sure to click the "Options>>" button and make sure "Match entire cell contents" checkbox is not checked.
 
Upvote 0
It finds the first / and second / and takes whats left and what is right and combines both of them

Since I know the character position of the first / and second /

Breaking it down its really 3 formulas combined

=LEFT(A13,SEARCH("/",A13,1)-1)
=&" "&
=RIGHT(A13,(LEN(A13)-FIND("/",A13,FIND("/",A13)+2)))


This only works if there are 2 "/"
 
Upvote 0

Forum statistics

Threads
1,215,398
Messages
6,124,699
Members
449,180
Latest member
craigus51286

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