Match & create a column

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,226
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
[TABLE="width: 397"]
<TBODY>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]FOOTBALL[/TD]
[TD]RUGBY[/TD]
[TD]BASEBALL[/TD]
[TD]HOCKEY[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]DANIEL[/TD]
[TD][/TD]
[TD]HARRY[/TD]
[TD][/TD]
[TD][/TD]
[TD]RUGBY[/TD]
[/TR]
[TR]
[TD]HARRY[/TD]
[TD]DANIEL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]FOOTBALL[/TD]
[/TR]
[TR]
[TD]WILLIAM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]MICHAEL[/TD]
[TD]HOCKEY[/TD]
[/TR]
[TR]
[TD]MICHAEL[/TD]
[TD][/TD]
[TD][/TD]
[TD]WILLIAM[/TD]
[TD][/TD]
[TD]BASEBALL[/TD]
[/TR]
[TR]
[TD]Carl[/TD]
[TD][/TD]
[TD][/TD]
[TD]CARL[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JERRY[/TD]
[TD][/TD]
[TD][/TD]
[TD]JERRY[/TD]
[TD][/TD]
[TD]BASEBALL[/TD]
[/TR]
</TBODY><COLGROUP><COL><COL><COL span=3><COL></COLGROUP>[/TABLE]

column A=Input & B1, C1, D1 & E1 is Input. B2:B7, C2;C7, D2:D7 & E2:E7 is to be MATCHED EXACTLY with column A to get column F.
How to accomplish?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Excel 2010
ABCDEF
1FOOTBALLRUGBYBASEBALLHOCKEY
2DANIELHARRYRUGBY
3HARRYDANIELFOOTBALL
4WILLIAMMICHAELHOCKEY
5MICHAELWILLIAMBASEBALL
6CarlCARL
7JERRYJERRYBASEBALL
Sheet3
Cell Formulas
RangeFormula
F2=IF(AND(UPPER(A2)=UPPER(LOOKUP(2,1/($B2:$E2<>""),B2:E2))=TRUE,EXACT(A2,LOOKUP(2,1/($B2:$E2<>""),B2:E2))=FALSE),"",LOOKUP(2,1/($B2:$E2<>""),$B$1:$E$1))
 
Upvote 0
Just a minute!!! In D3 I punched M & in the output cell F3 it shows BASEBALL which is INCORRECT since there is no cell containing M 'ONLY' in A2:A7.
 
Upvote 0
Just a minute!!! In D3 I punched M & in the output cell F3 it shows BASEBALL which is INCORRECT since there is no cell containing M 'ONLY' in A2:A7.


Excel 2010
ABCDEF
1FOOTBALLRUGBYBASEBALLHOCKEY
2DANIELHARRYRUGBY
3HARRYM
4WILLIAMMICHAELHOCKEY
5MICHAELWILLIAMBASEBALL
6CarlCARL
7JERRYJERRYBASEBALL
Sheet3
Cell Formulas
RangeFormula
F2{=IF(SUM(IF(ISNA(EXACT($A$2:$A$7,LOOKUP(2,1/($B2:$E2<>""),$B2:$E2))),"",--EXACT($A$2:$A$7,LOOKUP(2,1/($B2:$E2<>""),$B2:$E2))))=1,LOOKUP(2,1/($B2:$E2<>""),$B$1:$E$1),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
[TABLE="width: 397"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]FOOTBALL
[/TD]
[TD]RUGBY
[/TD]
[TD]BASEBALL
[/TD]
[TD]HOCKEY
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]DANIEL
[/TD]
[TD][/TD]
[TD]HARRY
[/TD]
[TD][/TD]
[TD][/TD]
[TD]RUGBY
[/TD]
[/TR]
[TR]
[TD]HARRY
[/TD]
[TD]DANIEL
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]FOOTBALL
[/TD]
[/TR]
[TR]
[TD]WILLIAM
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]MICHAEL
[/TD]
[TD]HOCKEY
[/TD]
[/TR]
[TR]
[TD]MICHAEL
[/TD]
[TD][/TD]
[TD][/TD]
[TD]WILLIAM
[/TD]
[TD][/TD]
[TD]BASEBALL
[/TD]
[/TR]
[TR]
[TD]Carl
[/TD]
[TD][/TD]
[TD][/TD]
[TD]CARL
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]JERRY
[/TD]
[TD][/TD]
[TD][/TD]
[TD]JERRY
[/TD]
[TD][/TD]
[TD]BASEBALL
[/TD]
[/TR]
</tbody>[/TABLE]

column A=Input & B1, C1, D1 & E1 is Input. B2:B7, C2;C7, D2:D7 & E2:E7 is to be MATCHED EXACTLY with column A to get column F.
How to accomplish?

Shorter in number of functions invoked...
Rich (BB code):
=IF(ISNA(LOOKUP(9.99999999999999E+307,
  FIND(" "&LOOKUP(REPT("z",255),B2:E2)&" "," "&$A$2:$A$7&" "))),"",
   LOOKUP(REPT("z",255),B2:E2,$B$1:$E$1))
If you would define BigNum as referring to:
Rich (BB code):
=9.99999999999999E+307
and BigStr as referring to:
Rich (BB code):
=REPT("z",255)
the formula becomes:
Rich (BB code):
=IF(ISNA(LOOKUP(BigNum,
  FIND(" "&LOOKUP(BigStr,B2:E2)&" "," "&$A$2:$A$7&" "))),"",
   LOOKUP(BigStr,B2:E2,$B$1:$E$1))
 
Upvote 0
Aladin's formula works well. But I am unable to decide which one will be more flexible + reliable?
 
Upvote 0

Forum statistics

Threads
1,223,727
Messages
6,174,144
Members
452,547
Latest member
Schilling

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