Find a certain word in a string in column B and then copy it to the left cell

GenjutsuGhost

New Member
Joined
Aug 4, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have the following problem.

I need to find a certain word in a string in column B and then copy it to the left cell of the cell.

So if there is a word in column B called
VBA Code:
""Dog": "","
I need the hole string in column B to copied to column A in the exact same row.

Two things maybe to notice is that all words are in quotation marks and they are all unique the same word can be found multiple times in column B, so I can't just find and replace, because they must be copied to the left in column A in the same row.

I hope this clarifies my problem.

The exact same format applies to all strings in column B, but then with a different word:

VBA Code:
""Dog": "","
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Welcome to the Board!

Try putting this formula in cell B1 and copy down for all rows:
Excel Formula:
=IF(ISNUMBER(SEARCH("Dog",A1)),A1,"")
 
Upvote 0
Welcome to the MrExcel board!

I think that you will need to include the quote marks to ensure that you don't get examples like row 3 below returned as well.

21 08 05.xlsm
AB
1
2""Dog": "","""Dog": "","
3 ""Endogamy": "","
Search Word
Cell Formulas
RangeFormula
A2:A3A2=IF(ISNUMBER(SEARCH("""Dog""",B2)),B2,"")


BTW, I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.
 
Upvote 0
Another thing I should mention:

SEARCH is not case-sensitive. So in searching for "Dog" it will also return things like "dog".
If case-sensitivity is important to you, then you can use the FIND function instead of SEARCH. It works the same way, but is case-sensitive.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

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