Formula for: Compare value of one cell to range of 5 cells?

photoguy53

New Member
Joined
May 27, 2004
Messages
37
Can anyone show me how to write a formula to compare the value of cell to the values in 5 different cells, and to return the value of the cell that the orginal cell matches?

What I'm trying to do is like this:

Does the value of C10 = C7, D7, E7, F7, G7
if it matches any of those cells, then return that value to my target cell.

Thanks!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Re: Formula for: Compare value of one cell to range of 5 cel

photoguy53 said:
Can anyone show me how to write a formula to compare the value of cell to the values in 5 different cells, and to return the value of the cell that the orginal cell matches?

What I'm trying to do is like this:

Does the value of C10 = C7, D7, E7, F7, G7
if it matches any of those cells, then return that value to my target cell.

Thanks!

=INDEX(C7:G7,MATCH(C10,C7:G7,0))

Will return #N/A if no match found
 
Upvote 0
If you don't want the #N/A then

=If(ISNA(INDEX(C7:G7,MATCH(C10,C7:G7,0))),"No Match",C10)
 
Upvote 0
Re: Formula for: Compare value of one cell to range of 5 cel

Both formulas worked! Thanks!!
I'll use DRJ's , since it's a little more elegant a solution.
Thanks to both!!
 
Upvote 0
Does this work without index. I wrote with and without index and i got same value. Formulas: =MATCH(A3,$F$3:$F$7,0) || =INDEX($A$3:$A$7,B3) || =INDEX($F$3:$F$7,MATCH(A3,$F$3:$F$7,0))

valueonly matchonly indexindex & matcharray
11111
22222
7#N/A#N/A#N/A3
9#N/A#N/A#N/A4
55555

<colgroup><col width="64" span="6" style="width:48pt"> </colgroup><tbody>
</tbody>

<colgroup><col width="64" span="7" style="width:48pt"> </colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,221,519
Messages
6,160,295
Members
451,636
Latest member
ddweller151

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