Return the item that is the same for two ranges

Mandark

New Member
Joined
Mar 18, 2014
Messages
43
Hi,

I have two ranges of cells. I would like to check if there is an item in both of those ranges and if so, to return the item.

Example:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Range1[/TD]
[TD]Range2[/TD]
[TD]Return value[/TD]
[/TR]
[TR]
[TD]Adam
[/TD]
[TD]Zoe[/TD]
[TD]Adam[/TD]
[/TR]
[TR]
[TD]Betty[/TD]
[TD]Xenia[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Chris[/TD]
[TD]Adam[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Danny[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Eva[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Assumption: Item exists and there is only one. Therefore the formula doesn't have to take into account other situations.

Thanks for help.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Oops, problem. My assumption was wrong. There can multiple items from the Range2 in the Range1. Example: both "Adam" and "Betty" in Range1. Is there a way to search from the one side (top or bottom)? The Range1 is actually sideways (one row, multiple columns), so I would need it to search from the right.
 
Upvote 0
Oops, problem. My assumption was wrong. There can multiple items from the Range2 in the Range1. Example: both "Adam" and "Betty" in Range1. Is there a way to search from the one side (top or bottom)? The Range1 is actually sideways (one row, multiple columns), so I would need it to search from the right.

A1: adam, B1: betty, C1: adam, D1: rick, E1: jon

H1: rick, I1: jon, J1: adam

Given these two horizontal ranges, what would be the expected output?
 
Upvote 0
A1: adam, B1: betty, C1: adam, D1: rick, E1: jon

H1: rick, I1: jon, J1: adam

Given these two horizontal ranges, what would be the expected output?


The ranges are following:
Range1
A1: Adam, B1: Betty, C1: Chris, D1: Danny, E1: Eva, ...

Range2
A1: Zoe
A2: Danny
A3: Chris


You see, there is both Danny and Chris in the both ranges. The current formula finds the first record, which is Chris.

What I need for my purposes is to go from the right side and find Danny.
 
Upvote 0
I'm glad it helped.

... The current formula finds the first record, which is Chris. ...

For the sake of clarity the formula is always finding the last value. It is not designed to find the first value.

In the first case it was finding the last value in Range2 and in the second case it's finding the last value in Range1.

You can do some tests with several strings common to the 2 ranges and you'll see that it's always the last value found, either in Range1 or in Range2 depending on you using the first or the second formula.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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