Extracting text data from a cell

Manexcel

Board Regular
Joined
Dec 28, 2015
Messages
127
Office Version
  1. 365
Platform
  1. Windows
I am trying to extract data from a cell(s) that contains surname, first name, middle name. e.g

bloggs, john charles

I am just after the surname e.g. bloggs

The following formula works well for my data.

=TRIM(MID(SUBSTITUTE(SUBSTITUTE($H12020,",","")," ",REPT(" ",100)),1+100*COLUMNS($H:H)-100,100))

However, I have now noticed some of my data has been entered as;

de smith, LH

The above formula is not working for this type of entered data and I now get an "N/A"

I have tried to manipulate the formula without success. Therefore, can anyone assist in my issue.

I thank you in anticipation.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi,

The formula you're using is way overkill if I understand correctly:


Excel 2010
ABCD
1bloggs, john charlesbloggsbloggs
2de smith, LHdede smith
Sheet5
Cell Formulas
RangeFormula
C1=TRIM(MID(SUBSTITUTE(SUBSTITUTE($A1,",","")," ",REPT(" ",100)),1+100*COLUMNS($H:H)-100,100))
D1=LEFT(A1,FIND(",",A1)-1)


D1 formula copied down, change Column/Cell reference as needed.
 
Upvote 0
Why not just use:
Code:
=LEFT(H12020,FIND(",",H12020)-1)
 
Upvote 0

Forum statistics

Threads
1,215,200
Messages
6,123,612
Members
449,109
Latest member
Sebas8956

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