Extracting text data from a cell

Manexcel

Board Regular
Joined
Dec 28, 2015
Messages
128
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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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