Trouble Extracting A String

Brad24

Board Regular
Joined
May 4, 2015
Messages
81
Hi, is there an easy way to extract a name from the following string?

The string has the following format. I just want James Bond out of this string.

James Bond J. Bond
 
Try this formula to place the desired value (not the formula) directly in the cell...
Code:
[table="width: 500"]
[tr]
	[td]Workbooks(MyWorkbook).Sheets(MyWorksheet).Range("O1").Value = Left(Range("A457").Value, InStrRev(Left(Range("A457").Value,Len(Range("A457").Value)-1), ".") - 3)[/td]
[/tr]
[/table]
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I spot checked and it works. Can you tell me why these Ranges aren't correct?

Code:
For j = StartRow + 3 To EndRow + 2 Step 3
    Workbooks(MyWorkbook).Sheets(MyWorksheet).Range("N" & j).Value = Left(Range("A" & j).Value, InStrRev(Left(Range("A" & j).Value, Len(Range("A" & j).Value) - 1), ".") - 3)
Next j
 
Upvote 0
I spot checked and it works. Can you tell me why these Ranges aren't correct?

Code:
For j = StartRow + 3 To EndRow + 2 Step 3
    Workbooks(MyWorkbook).Sheets(MyWorksheet).Range("N" & j).Value = Left(Range("A" & j).Value, InStrRev(Left(Range("A" & j).Value, Len(Range("A" & j).Value) - 1), ".") - 3)
Next j

What do you mean by "aren't correct"? What is happening... or not happening... that makes you ask that question?
 
Upvote 0
I figured it out. It was looking at the rows that had the number sign like #12 etc, and was failing instead of the rows with the names in them.

Thanks for your help! I appreciate you staying with this one.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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