confirional formatting using vlookup and wildcards

mkayz

New Member
Joined
Jun 24, 2011
Messages
5
Hi experts,

Got a problem wondering if anyone can help.

I have two coloumns

A B
apple apple
apple2 orrange
apple3 pair
apple
pair
etc...

I have a conditional formatting rule as

=NOT(ISERROR(VLOOKUP($A1,$B:$B,1,FALSE)))

the above will format the cells in A if it matches the values in B

so the above will format apple and pair

Is there a way to make it also format apple2, and apple3 if there is only apple in column B.

I have tried

=NOT(ISERROR(VLOOKUP($A1 & "*",$B:$B,1,FALSE)))

and it doesnt work, completely stuck.

Thanks for your time.

MKayZ
 
Hi thanks again for your help.

maybe my example data was not very clear...

A
apple
mango
pear
apple2
apples
peach
peachs
anything

B
apple
pear
orange


what is wanted is apple, pear, apple2, apples, to be formatted.

so fair i tried both, suggestions and they give strange results, not sure what i am doing wrong. please help.
Here's the result I get using this formula:

=OR(ISNUMBER(SEARCH(B$2:B$4,A2)))

Book1
AB
2appleapple
3mangopear
4pearorange
5apple2_
6apples_
7peach_
8peachs_
9anything_
Sheet1

Here's how to apply it...

Select the *entire* range A2:A9 starting from cell A2.
Cell A2 will be the active cell. The active cell is the
one cell in the selected range that is not shaded. The
formula will be relative to the active cell.
  • Goto the Home tab>Styles>Conditional Formatting>Manage rules>New rule>Use a formula to determine which cells to format
  • Enter this formula in the box below:
    =OR(ISNUMBER(SEARCH(B$2:B$4,A2)))
  • Click the Format button
  • Select the desired style(s)
  • OK out
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,224,524
Messages
6,179,308
Members
452,904
Latest member
CodeMasterX

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