Advanced Search VBA, search text within text and pull in values

Zenru

New Member
Joined
Oct 19, 2017
Messages
29
Hello everybody,


I have two sheets with information in Excel, one (SheetB) where there are unique values like the one below:

Part1Part2Part3ConcatValue-1Value-2
ASNDWUX45ASNDWUX45120000
PUGBSCARLPUGBSCARL50007000
ASNDWUX48ASNDWUX4805000
COMPASQN5COMPASQN510005000
PUGBSCAR8PUGBSCAR851551548

<tbody>
</tbody>




And I have another sheet (SheetA), with the same values as above, but:

  • They repeat
  • Some might have in part3 concatenated information like: 45, 4F, 65D, S


So, I need a macro that, when a value changed in a specific range in SheetB (range might grow in rows, no columns would be added), will search in sheetA for matching values in Part1 and Part2, and will do a search() like formula in Part3, where a cell in SheetB.Part3 is the search text, and SheetA.Part3 is the within text.


So,
**SheetB**
Part1Part2Part3ConcatValue-1Value-2
ASNDQEE45ASNDWUX45120000
PUGBSCARLPUGBSCARL50007000
ASNDQEE48ASNDWUX4805000
COMPASQN5COMPASQN510005000
PUGBSCAR8PUGBSCAR851551548

<tbody>
</tbody>



**SheetA**
Part1Part2Part3ConcatValue-1Value-2
ASNDQEE42,45,89ASNDWUX120000Part1 and 2 matched, "45" was found in part3
PUGBSCAR4PUGBSCApart1 and 2 matched, no match part3
ASNDQEE45,48,49ASNDWUX120005000part1 and 2 matched, 2 matches in part3. 45 and 48 both found, get biggest value from SheetB
COMPASQN5COMPASQ10005000all parts matched
PUGBNDMR8PUGBSCA51551548Part1 and Part3 matched, part2 not.

<tbody>
</tbody>



I am not sure if this can be done by formula, if so it should be an array type or something. I rather not use complicated formulas because there will be lots of data columns in SheetA to be recalculated thanks to changes in SheetB.


The only part where a SEARCH would be done would be Part3, because Part1 and Part2 and the Value-x will not have concatenated information.


How can I do this?
 
Yes, they are from SheetA.

You said ...
I want to populate the Value-1… columns in SheetA from the sheetB.
.. which to me implied two things ..
i) You wanted formulas for the red columns below, and
ii) Therefore you must already have the information in the blue columns
.. in the SheetA that you originally posted.

That is why I used C2 and D2 (from SheetA) in my formula - because I believed they were already there.

If C2 (Part3) and D2 (Concat) are not already there, what does this description mean as it refers to the Part3 column "Part1 and 2 matched, "45 was found in part3"? :confused:




**SheetA**
Part1Part2Part3ConcatValue-1Value-2
ASNDQEE42,45,89ASNDWUX120000Part1 and 2 matched, "45" was found in part3
PUGBSCAR4PUGBSCApart1 and 2 matched, no match part3
ASNDQEE45,48,49ASNDWUX120005000part1 and 2 matched, 2 matches in part3. 45 and 48 both found, get biggest value from SheetB
COMPASQN5COMPASQ10005000all parts matched
PUGBNDMR8PUGBSCA51551548Part1 and Part3 matched, part2 not.

<tbody>
</tbody>
 
Last edited:
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hello, it was incredible rude of me to not give an update on this. Thanks everyone for the input. I went the VBA way, I used and modified Marcelo's code a bit and it worked perfecttly.
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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