Avatar of Mike Page
Mike Page
 asked on

Find word within cell & put value in adjacent

Hi Experts,

I have a large excel dataset where I want to find a specfic text and move it to the next column.
For example the text is in cell H and needs to be moved to cell I.

=IF(ISERROR(SEARCH("*SlideOpened*",H1,1)),"","SlideOpened ")

Please advice

Thanks

Mike
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Tracy

8/22/2022 - Mon
AL_XResearch

Hi Mike,

Can you please clarify your question. The formula you have provided works to the job you are asking advice about - so what is the issue ? Making the text to search dynamic perhaps ?
Mike Page

ASKER
Hi Al,

i tried it but it doesn't seem to copy to the next column. I foukd the example here

http://ccm.net/forum/affich-46323-find-word-within-cell-put-value-in-adjacent

judt wonder if there was another way.

Thanks
Mike Page

ASKER
ok found my error

=IF(ISERROR(SEARCH("*SlideOpened*",H2,1)),"","SlideOpened ")
Your help has saved me hundreds of hours of internet surfing.
fblack61
AL_XResearch

Good news ! It is nearly always some small mistake you don't see.
Mike Page

ASKER
can I ask..

what if I have two or more 'items' that i need to copy across.. how would I do it

=IF(ISERROR(SEARCH("*SlideOpened*",H2,1)),"","SlideOpened ")
Mike Page

ASKER
for exampel
=IF(ISERROR(SEARCH("*SlideOpened*,*CorrectAnswer*",H2,1)),"","SlideOpened, CorrectAnswer ")
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
AL_XResearch

If you wanted to search one cell for either the word 'car' or 'pipe' then you would use:
=IF(AND(ISERROR(SEARCH("car",H9)),ISERROR(SEARCH("pipe",H9)))=TRUE,"","SlideOpened ")

Open in new window

AL_XResearch

If you wanted a more extensible formula that you can add multiple words to and have it search for any in the on cell:
=IF(COUNT(SEARCH({"car","source","is"},H9)),"SlideOpened","")

Open in new window

Mike Page

ASKER
just to be clarify please
on Cell H, I may have

        H
SlideOpened
Action
Close

how do I move them to cell B
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Norie

Do you have a list of the values you want to search for?
Mike Page

ASKER
HI,

Thiis is the result of this formular

=IF(COUNT(SEARCH({"SlideOpened","CorrectAnswer"},H2,1)),"SlideOpened","CorrectAnswer")

H                       I
SlideOpened      SlideOpened
SlideOpened      SlideOpened
1397.25              CorrectAnswer
AL_XResearch

Mike I think you have misunderstood
=IF(COUNT(SEARCH({"SlideOpened","CorrectAnswer"},H2,1)),"SlideOpened","CorrectAnswer")

Open in new window

makes no sense because what the 'COUNT(SEARCH({"SlideOpened","CorrectAnswer"},H2,1))' is saying is 'If you find 'SliderOpened' OR 'CorrectAnswer' in cell H2 then return TRUE. So you entire formula is saying is 'If you find 'SlideOpened' OR 'CorrectAnswer' then return 'SlideOpened' but if neither of those values are in the cell H2 then return 'CorrectAnswer'.

Based on the last part of your formula I think what you are trying to find is: if the test cell (H2) contains one of the test words then return only that test word in to the column I cell. Is that correct ? Because that is not what I understood from your initial request.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
AL_XResearch

Can there only ever be one of the test values in the test cell ?
AL_XResearch

I will have to have a deeper think about how to do this in a cell formula. It would be straightforward in VBA but a formula is another thing.

You see the problem is having multiple test values. As they can each have different lengths there is no obvious way to identify which of the test words were found and therefore determine the length of text to extract.
Mike Page

ASKER
if the test cell (H2) contains one of the test words then return only that test word in to the column I cell.

Yes this is what I am looking for
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
AL_XResearch

Yes that is basically what I am thinking. Have 'hidden helper' columns that enable you a) to test for multiple words b) allow you to change those words dynamically.

I will have to look at this after work but I really very busy at the moment.

The best solution would be to create a User Defined Function in VBA to do this,
ASKER CERTIFIED SOLUTION
AL_XResearch

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tracy

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: AL_XResearch (https:#a42100995)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

broomee9
Experts-Exchange Cleanup Volunteer