return column header for each value occurrence in a table

Rosa94

New Member
Joined
Jul 2, 2019
Messages
9
Hello,

I have a table countries and jobs in that country. I am looking to select the job and get all the countries that job is in. Example: select Janitor and the output will show USA,China and Canada

USASpainChinaCanadaMexico
JanitorPayrollJanitorHRManager
OperatorPayrollJanitor
Manager2DVP
HR

<tbody>
</tbody>

Is this something excel can do or is this something only access can process?
Thank you for your help.
Rosa
 

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.
Hi & welcome to MrExcel.
How about


Book1
ABCDE
1USASpainChinaCanadaMexico
2JanitorPayrollJanitorHRManager
3OperatorPayrollJanitor
4Manager2DVP
5HR
6
7
8JanitorUSA
9China
10Canada
Report
Cell Formulas
RangeFormula
B8=IFERROR(INDEX($A$1:$E$1,AGGREGATE(15,6,(COLUMN($A$1:$E$1)-COLUMN($A$1)+1)/($A$2:$E$5=$A$8),ROWS($A$1:$A1))),"")
 
Upvote 0
You're AMAZING!!!!
can you please explain each piece of the formula for me? My table is much larger and am not sure how the "(15,6," comes into play.
THANK YOU SOOOO MUCH!!! :biggrin:
 
Upvote 0
Thank you soooo much!!!

Do you have a suggestion of maybe something better to use if i'm doing this on a LARGE scale? Ex a table of 16,000 cells of data and 130 jobs to look for with possibly 100 countries.
 
Upvote 0
If the formula is too slow, then you could use either a database, or VBA.
 
Upvote 0
It may also be possible to do this with Power Query/Get & Transform
 
Upvote 0
It may also be possible to do this with Power Query/Get & Transform

Thanks Fluff :)

USASpainChinaCanadaMexicoNameJanitor
JanitorPayrollJanitorHRManager
OperatorPayrollJanitorHeader
Manager2DVPCanada
HRChina
USA

With PowerQuery and PivotTable

Code:
[SIZE=1]// Table3
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    Demote = Table.DemoteHeaders(Source),
    Transpose = Table.Transpose(Demote),
    Unpivot = Table.UnpivotOtherColumns(Transpose, {"Column1"}, "Attribute", "Value"),
    ROC = Table.SelectColumns(Unpivot,{"Column1", "Value"}),
    Rename = Table.RenameColumns(ROC,{{"Column1", "Header"}, {"Value", "Name"}})
in
    Rename[/SIZE]
 
Upvote 0
Oh man! I'm excited and scared at the same time.

I am not familiar with PowerQuery and have not used PivotTables very often. Is there a a link you can send me to help me figure out your beautiful work?

Have I told you how amazing your are?
:biggrin:
 
Upvote 0
but solution need PowerQuery

you can download it here: Example file

Excel 2010 / 2013 require PowerQuery add-in (from MS site for free)
Higher version has PowerQuery (aka Get&Transform) built-in
 
Upvote 0

Forum statistics

Threads
1,214,800
Messages
6,121,641
Members
449,044
Latest member
hherna01

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