How do I return a columns values into a different sheet using a column name?

InfiniteDoors

New Member
Joined
Nov 25, 2013
Messages
2
Okay, so what I'm trying to do is something similar to a v-look up, except I want to search by a column name.

For instance:

I have Excel file 1 with only two column names, "Fruits" in A1 and, "Vegetables" in D1. So it looks like:

Fruits

<tbody>
</tbody>

Vegetables

In Excel file 2 I have again two column names (however there could be other names depending on the workbook) of, "Vegetables" in A1 and "Fruits" in F1. In this file I have items listed under vegetables and fruits. So it looks like:

Vegetables
asparagus
green beans
spinach
broccoli
cabbage
carrots

Fruits
orange,banana
pear,apple
strawberry
peach,blueberries

<tbody>
</tbody>

<tbody>
</tbody>


Now, what I would like to be able to do is something like search the column name, "Fruits" and have it return the columns values that go under the header in File 2 to show in File 1. So essentially it is matching the column header names, then returning the column on where it located the name. Is this possible?

I appreciate the help.
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Here's an example with all the data on one worksheet (formula in I2 copied down and across). Adjust the references to suit:


Excel 2010
ABCDEFGHIJ
1VegetablesFruitsFruitsVegetables
2asparagusorange,bananaorange,bananaasparagus
3green beanspear,applepear,applegreen beans
4spinachstrawberrystrawberryspinach
5broccolipeach,blueberriespeach,blueberriesbroccoli
6cabbagecabbage
7carrotscarrots
Sheet1
Cell Formulas
RangeFormula
I2=INDEX(INDEX($A$2:$G$10,0,MATCH(I$1,$A$1:$G$1,FALSE)),ROWS(I$2:I2))
 
Upvote 0

Forum statistics

Threads
1,215,096
Messages
6,123,074
Members
449,094
Latest member
mystic19

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