match and return column headers

excellingatnothing

New Member
Joined
Mar 14, 2018
Messages
4
FindReturn20Header1Header2Header3Header 4Header 5
hotelHeader2alphabetabetaalphabeta
Header4betacharlieechohotelgolf
hotel

<tbody>
</tbody>

copied this from somewhere but can't implement it on mine. i'm a total excel noob, excuse the absolute $ signs.
basically i have a large excel with different products, each product could potentially contain the same documents, and i want to be able to find one document and have it output all of the products it is included in. i got it to work but it stopped working when the documents list exceeded 20.

C1 = COUNTIF($F$2:AF20,"="&A2)

B2 = IF(COLUMNS($B$2:$B$2)>($C$1-$D$1)," ",INDEX($F$1:$AF$1,SMALL(IF($F$2:$AF$2=$A$1,COLUMN($F$2:$AF$99)-COLUMN($F$2)+1),COLUMNS($B$2:B2))))

B3 = IF(COLUMNS($B$2:$B$2)>($C$1-$D$1)," ",INDEX($F$1:$AF$1,SMALL(IF($F$2:$AF$2=$A$1,COLUMN($F$2:$AF$99)-COLUMN($F$2)+1),COLUMNS($B$2:C2))))

B4 = ...
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Product AProduct AProduct AProduct BProduct BProduct BProduct CProduct CProduct CProduct DProduct DProduct DProduct EProduct EProduct E
Doc CodeLast SubmittedRevisionDoc CodeLast SubmittedRevisionDoc CodeLast SubmittedRevisionDoc CodeLast SubmittedRevisionDoc CodeLast SubmittedRevision
FIND1241231111231241
124112abc14575
DOCSProduct A23412466610
Product B344345
Product D456567
abc1

<tbody>
</tbody>

Maybe this is more clear with the actual columns I have.
Each product further divided into document code, last submitted date, and revision.

I want to FIND a certain document, from ALL the products, and output the product names that include the document. Every product is different, most doc codes are different but can be shared. Submitted dates are all different. Revisions are the last revision noted during the date submitted.
 
Upvote 0
The reverse pivot table above will do this: delete the second row and be sure there's a header over each column (merged cells usually sacrifice function for style and end up with neither). Then you can retrieve the original, normal format of the table:


Excel 2010
CDEFGHIJKLMNOPQR
1Product AProduct AProduct AProduct BProduct BProduct BProduct CProduct CProduct CProduct DProduct DProduct DProduct EProduct EProduct E
211231111231241
32124112abc14575
4323412466610
54344345
65456567
76abc1
Sheet10 (2)


to:


Excel 2010
ABC
1RowColumnValue
111Product D124
172Product A124
353Product B124
Sheet18
 
Last edited:
Upvote 0
But if you must have a formula:


Excel 2010
ABCDEFGHIJKLMNOPQR
1Product AProduct AProduct AProduct BProduct BProduct BProduct CProduct CProduct CProduct DProduct DProduct DProduct EProduct EProduct E
2FIND1241231111231241
3124112abc14575
4DOCSProduct A23412466610
5Product B344345
6Product D456567
7abc1
Sheet10 (2)
Cell Formulas
RangeFormula
B4{=INDEX($D$1:$R$1,SMALL(IF($D$2:$R$7=$B$2,COLUMN($D$2:$R$7)),ROW(A1))-2)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
THANK YOU! That shorter formula worked. Just changed the -2 to -5 and adjusted the cell locations. I didn't realize that was to offset the location.
 
Upvote 0

Forum statistics

Threads
1,216,188
Messages
6,129,397
Members
449,508
Latest member
futureskillsacademy

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