Retrieve column names

yevhen

New Member
Joined
Jan 5, 2025
Messages
8
Office Version
  1. 2021
Platform
  1. Windows
How it's possible to retrieve column names as a list from a list of tables?
Screenshot 2025-01-27 164329.png
 

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).
How it's possible to retrieve column names as a list from a list of tables?
View attachment 121690
You can use the INDIRECT function.

Sample Data.xlsm
DEFGH
3
4tblWeightsWeight Unit, Abbreviation
5tblCheesesFood Type, Cheese
6tblFoodItemFood Type, Food Item
7
8tblWeightsWeight UnitAbbreviation
9tblCheesesFood TypeCheese
10tblFoodItemFood TypeFood Item
11
Weights
Cell Formulas
RangeFormula
F4:F6F4=TEXTJOIN(", ",TRUE,INDIRECT(E4 & "[#Headers]"))
F8:G10F8=INDIRECT(E8 & "[#Headers]")
Dynamic array formulas.
 
Upvote 0
Thanks but I need to do this particularly in PQ to be it dynamic.
 
Upvote 0
Power Query:
List.Distinct(List.Combine(List.Transform(list_of_tables, Table.ColumnNames)))
 
Upvote 0
Solution
Power Query:
List.Distinct(List.Combine(List.Transform(list_of_tables, Table.ColumnNames)))
For more clarity added some changes:
List.Distinct(List.Combine(List.Transform(list_of_tables, each Table.ColumnNames(_))))
 
Upvote 0

Forum statistics

Threads
1,226,266
Messages
6,189,939
Members
453,583
Latest member
Ok_category1816

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