left and right formula help

plost33

Well-known Member
Joined
Oct 2, 2008
Messages
866
i have a list of names. such as: John Smith.

I need a formula that will return: "JSmith"


I know this is some form or left and right but i dont know how to incorporate the formula identifying a "space" and taking whats right of that to get the last name. hope someone can assist.. thanks
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
If the name is ALWAYS "First Last" then try

=REPLACE(A1,2,FIND(" ",A1)-1,"")
 
Upvote 0
jonmo, how do i fix this formula you gave me to have it put into the referenced cell:

i have this so far:

Range("S" & r).formula = "=REPLACE(B7,2,FIND(" & " & " & ",B7)-1,"")



the formula i want to put in the cell is:

=REPLACE(B7,2,FIND(" ",B7)-1,"")


thanks
 
Upvote 0
The same way we did it in your other post
http://www.mrexcel.com/forum/showthread.php?t=554161

You don't need to concatenate to put quotes in the formula.
Instead, you just double up the quotes..

If you want this formula in the cell
=REPLACE(B7,2,FIND(" ",B7)-1,"")

In VBA, you just double up the quotes

Range(...).Formula = "=REPLACE(B7,2,FIND("" "",B7)-1,"""")"

hope that helps.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

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