Function to result column header based on text in a column

cb743

New Member
Joined
Apr 8, 2019
Messages
1
Hello, I am relatively new to excel. I want to create a function that will search for a name and result the heading (team).


[TABLE="width: 290"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Capitals[/TD]
[TD]Wizards[/TD]
[TD]Nationals[/TD]
[TD]Redskins[/TD]
[/TR]
[TR]
[TD]James[/TD]
[TD]Corey[/TD]
[TD]Hannah[/TD]
[TD]Test1[/TD]
[/TR]
[TR]
[TD]Mike[/TD]
[TD]Amy[/TD]
[TD]Test3[/TD]
[TD]Test2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Each heading will have around 10 users.

An example of the end result that I want is insert corey into a cell and have it output the team corey is on[TABLE="width: 500"]
<tbody>[TR]
[TD]User[/TD]
[TD]Team[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
one way

Excel 2016 (Windows) 32 bit
[Table="width:, class:head"][tr=bgcolor:#E0E0F0][th] [/th][th]
A
[/th][th]
B
[/th][th]
C
[/th][th]
D
[/th][th]
E
[/th][th]
F
[/th][th]
G
[/th][th]
H
[/th][/tr]
[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
1
[/td][td]Capitals[/td][td]Wizards[/td][td]Nationals[/td][td]Redskins[/td][td].[/td][td]User[/td][td]Team[/td][td] Formula (copied down)[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
2
[/td][td]N001[/td][td]N101[/td][td]N201[/td][td]N301[/td][td][/td][td]N313[/td][td]Redskins[/td][td]=IF(COUNTIF(A:A,F2)>0,$A$1,IF(COUNTIF(B:B,F2)>0,$B$1,IF(COUNTIF(C:C,F2)>0,$C$1,IF(COUNTIF(D:D,F2)>0,$D$1,"Not Found"))))[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
3
[/td][td]N002[/td][td]N102[/td][td]N202[/td][td]N302[/td][td][/td][td]N004[/td][td]Capitals[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
4
[/td][td]N003[/td][td]N103[/td][td]N203[/td][td]N303[/td][td][/td][td]N312[/td][td]Redskins[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
5
[/td][td]N004[/td][td]N104[/td][td]N204[/td][td]N304[/td][td][/td][td]Matey[/td][td]Not Found[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
6
[/td][td]N005[/td][td]N105[/td][td]N205[/td][td]N305[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
7
[/td][td]N006[/td][td]N106[/td][td]N206[/td][td]N306[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
8
[/td][td]N007[/td][td]N107[/td][td]N207[/td][td]N307[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
9
[/td][td]N008[/td][td]N108[/td][td]N208[/td][td]N308[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
10
[/td][td]N009[/td][td]N109[/td][td]N209[/td][td]N309[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
11
[/td][td]N010[/td][td]N110[/td][td]N210[/td][td]N310[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
12
[/td][td]N011[/td][td]N111[/td][td]N211[/td][td]N311[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
13
[/td][td]N012[/td][td]N112[/td][td]N212[/td][td]N312[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
14
[/td][td]N013[/td][td]N113[/td][td]N213[/td][td]N313[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
15
[/td][td]N014[/td][td]N114[/td][td]N214[/td][td]N314[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]
[Table="width:, class:grid"][tr][td]Sheet: Sheet1[/td][/tr][/table]
 
Upvote 0
Welcome to the forum! Here is another option you can try.


Excel 2013/2016
ABCDEFG
1CapitalsWizardsNationalsRedskinscoreyWizards
2JamesCoreyHannahTest1
3MikeAmyTest3Test2
Sheet1
Cell Formulas
RangeFormula
G1=INDEX($A$1:$D$1,AGGREGATE(15,6,COLUMN($A$1:$D$1)-MIN(COLUMN($A$1:$D$1))+1/($A$1:$D$3=F1),1))
 
Upvote 0

Forum statistics

Threads
1,226,112
Messages
6,189,040
Members
453,521
Latest member
Chris_Hed

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