Cana forumla extract what I need

easybpw

Active Member
Joined
Sep 30, 2003
Messages
439
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Hello and thanks in advance for the help. Below is a string of characters and I need to extract the last name of the employee. The format will always be the same, there will always be 3 numbers to the left with a space between. I can extract everything to the left but my limited knowledge doesn't allow me to do what I need. In my example below I am looking for "Smith".

Tender type: Staff Charge Employee ID: 99999999 Cost centre: 005 Smith,John

Thanks again!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Try:

=TRIM(RIGHT(SUBSTITUTE(REPLACE(A1,FIND(",",A1),LEN(A1),"")," ",REPT(" ",LEN(A1))),LEN(A1)))
 
Upvote 0
Hello and thanks in advance for the help. Below is a string of characters and I need to extract the last name of the employee. The format will always be the same, there will always be 3 numbers to the left with a space between. I can extract everything to the left but my limited knowledge doesn't allow me to do what I need. In my example below I am looking for "Smith".

Tender type: Staff Charge Employee ID: 99999999 Cost centre: 005 Smith,John

Thanks again!


Is there always going to be a comma directly after the last name?

Will there ever be a comma in any other part of the string, other than directly after the last name?

-Spydey


P.S. Looks like Eric W. beat me to it .... hehehe.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,747
Messages
6,180,719
Members
452,995
Latest member
isldboy

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