Concatenate

EvansB2

Board Regular
Joined
Nov 25, 2008
Messages
245
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I have a numbers and text in a single cell (call it A1), namely:

"L-HQ-0001,Entrance Foyer"

I would like to split the string so that in cell B1 it would return the following result:

"L-HQ-001"

Therefore, removing the text along with the comma.

Any assistance would be gratefully received as I have around 3,000 entries to split.

Regards

Ben
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Try
(I assume your result was a typo and you do not want to remove a zero)

Code:
=LEFT(A1,SEARCH(",",A1)-1)
 
Upvote 0
If they are all in the same column, you can do this easily with Text to Columns.
Just choose the comma as the delimiter, and elect to "Do not import column (skip)" the second column.

If they are all over the place and you need a formula, try this:
Code:
=LEFT(A1,FIND(",",A1)-1)
 
Upvote 0
They all appear uniform.

So what is the difference between 'FIND' and 'SEARCH' in this instance?

Regards

Ben
 
Upvote 0
The difference between find and search is find IS case sensitive search is not. Since this is a "," it does not matter here.

Search is also at the top of the tool tip so to use it you can just type in =s and search will be highlighted and you can tab to use the function.
 
Upvote 0
Code:
[COLOR=#333333]Since this is a "," it does not matter here.[/COLOR]
LOL! I confused this with another one I was helping with in which we were searching for a specific word!
Obviously, case doesn't matter with punctuation!:laugh:
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,226
Members
452,620
Latest member
dsubash

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