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

[TABLE="class: grid, width: 10"]
<tbody>[TR]
[TD]USA[/TD]
[TD]Spain[/TD]
[TD]China[/TD]
[TD]Canada[/TD]
[TD]Mexico[/TD]
[/TR]
[TR]
[TD]Janitor[/TD]
[TD]Payroll[/TD]
[TD]Janitor[/TD]
[TD]HR[/TD]
[TD]Manager[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Operator[/TD]
[TD]Payroll[/TD]
[TD]Janitor[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Manager2[/TD]
[TD]DVP[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]HR[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Is this something excel can do or is this something only access can process?
Thank you for your help.
Rosa
 
Have I told you how amazing your are? :biggrin:

I know, but I have not won the Nobel Prize yet
rotfl2.gif
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Where do i put the lovely pivot table code you provided me?

How do i get the Header and Name options on my table? When i try to create my pivot table I get the list of countries for my options.
 
Upvote 0
i cant get my power query to work :(. I'm still getting the list of countries to choose from not "header" and "name"
 
Upvote 0
ab ovo...

  1. copy M-code from the post
  2. select your source range
  3. from the ribbon -Data - From Table (it will open new window)
  4. in Advanced Editor replace code with copied code (make sure the name of the table is the same like in replaced code)
  5. it should show transformed table in PQ Editor
  6. Close&Load as .... Connection only

then
Insert - Pivot Table ... the rest is on the movie
 
Upvote 0
:laugh::laugh::laugh:
You are welcome

Now you can click Like/Thanks at the bottom left corner in post(s) which helped you :)

Have a nice day
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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