Formula to lookup cells between ranges of columns and rows?

Lou1

New Member
Joined
May 3, 2011
Messages
6
This thread might be more appropriate titled: "What would be the formula to find if any cells in a column's range matches any cells in a row's range of cells.....
and then return a yes or no value for that particular row.'

My guess is that this can be done with a vlookup, but maybe not. So far I have been unable to do it but I'm sure it can be done.

EXAMPLE
*I have a column of cells:
Blue
White
Red
Magenta
etc

*and I want to see if any of the cells in that column match a particular row of data (the commas in the example represent separate cells in the example row)
Row 1: Green, Yellow, Red, Purple
Row 2: Blue, Magenta, White, Black

In this example, Row 1 would show a 'yes' because the color 'Red' matches. Row 2 would show a 'yes' because the color 'Magenta' matches.

***It's necessary that the 'yes' or 'no' appears on the same row in which a match has been found. (in order to keep the data organized).

Thanks for your help with this question! :)
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
This thread might be more appropriate titled: "What would be the formula to find if any cells in a column's range matches any cells in a row's range of cells.....
and then return a yes or no value for that particular row.'

My guess is that this can be done with a vlookup, but maybe not. So far I have been unable to do it but I'm sure it can be done.

EXAMPLE
*I have a column of cells:
Blue
White
Red
Magenta
etc

*and I want to see if any of the cells in that column match a particular row of data (the commas in the example represent separate cells in the example row)
Row 1: Green, Yellow, Red, Purple
Row 2: Blue, Magenta, White, Black

In this example, Row 1 would show a 'yes' because the color 'Red' matches. Row 2 would show a 'yes' because the color 'Magenta' matches.

***It's necessary that the 'yes' or 'no' appears on the same row in which a match has been found. (in order to keep the data organized).

Thanks for your help with this question! :)
Try this...

Book1
ABCDEFG
2BlueGreenYellowRedPurpleYes
3WhiteBlueMagentaWhiteBlackYes
4Red
5Magenta
Sheet2

Formula entered in G2 and copied down:

=IF(SUMPRODUCT(--(ISNUMBER(MATCH(C2:F2,A$2:A$5,0)))),"Yes","No")
 
Upvote 0
Thanks for your rapid response T. Valko.

I need to do a related task that you or another member of the community could help with:

As a follow-up to the example in this thread:

I need to be able to show the actual cell value that matches rather than just a 'yes' or 'no.' To put it another way, I need to display which cells in a column's range matches the cells in a row's range of cells.

SAME EXAMPLE WITH A SLIGHT DIFFERENCE
I want to see if any of the cells in a particular column match a particular row of data.

Below is a visual example.

EDAmYympZTtxQ4mQxQO0yn36CG2i1THEiLIU_iTIRDI


In this example, Row 1 displays 'Red' because the color 'Red' matches. Row 2 displays 'Magenta' because the color 'Magenta' matches.

***NOTE: I need to make sure that the matching value is displayed on the same row in which it was found. So for example, Row 1 would display the color 'Red' on the same row (in Row 1).

Lou
 
Upvote 0
Looks like the visual example did not appear in my latest reply: the link for the image is available at:
https://picasaweb.google.com/lh/photo/EDAmYympZTtxQ4mQxQO0yn36CG2i1THEiLIU_iTIRDI?feat=directlink

<table style="width:auto;"><tr><td><a href="https://picasaweb.google.com/lh/photo/EDAmYympZTtxQ4mQxQO0yn36CG2i1THEiLIU_iTIRDI?feat=embedwebsite"><img src="https://lh6.googleusercontent.com/_S3A0fYh1X1o/TcR1sfwAd4I/AAAAAAAAAhA/gtlVnE5eISE/s144/excel2.jpg" height="53" width="144" /></a></td></tr><tr><td style="font-family:arial,sans-serif; font-size:11px; text-align:right">From <a href="https://picasaweb.google.com/jeremycotter/LightCompassBoostTrafficAndROI?authkey=Gv1sRgCNrhrNTqw52RhAE&feat=embedwebsite">LightCompass - Boost Traffic and ROI</a></td></tr></table>
 
Upvote 0
Looks like the visual example did not appear in my latest reply: the link for the image is available at:
https://picasaweb.google.com/lh/photo/EDAmYympZTtxQ4mQxQO0yn36CG2i1THEiLIU_iTIRDI?feat=directlink

<TABLE style="WIDTH: auto"><TBODY><TR><TD></TD></TR><TR><TD style="FONT-SIZE: 11px; FONT-FAMILY: arial,sans-serif; TEXT-ALIGN: right">From LightCompass - Boost Traffic and ROI</TD></TR></TBODY></TABLE>
Ok, what if there is more than one matching entry? Also, what result do you want if there are no matching entries?
 
Upvote 0
Hi,

Try this array-formula

=INDEX(C1:F1,MATCH(1,1-ISNA(MATCH(C1:F1,$A$1:$A$4,0))))
Confirmed with Ctrl+Shift+Enter
(hold down both Ctrl and Shift keys and hit Enter)

HTH

M.
ps: if more than one color in a row match column A the formula shows only the right-most
 
Upvote 0
-EDIT-

Better

Excel 2007 or higher
=IFERROR(INDEX(C1:F1,MATCH(1,1-ISNA(MATCH(C1:F1,$A$1:$A$4,0)))),"No match")
Ctrl+Shift+Enter

-EDIT-
oops..
Disregard this post


M.
 
Last edited:
Upvote 0
This is Ok
=IFERROR(INDEX(C1:F1,MATCH(1,1-ISNA(MATCH(C1:F1,$A$1:$A$4,0)),0)),"No match")
Ctrl+Shift+Enter

Gets the left-most if more than one match

M.
 
Upvote 0
This worked perfectly Marcelo - thank you! And I also appreciate you reminding to do the Ctrl+Shift+Enter (rather than just Enter) to ensure the formula worked.
 
Upvote 0
This worked perfectly Marcelo - thank you! And I also appreciate you reminding to do the Ctrl+Shift+Enter (rather than just Enter) to ensure the formula worked.

You are welcome.

Tks for providing feedback

M.
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,480
Members
452,915
Latest member
hannnahheileen

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