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:

[TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl63, width: 64"]Fruits
[/TD]
[/TR]
</tbody>[/TABLE]

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:

[TABLE="width: 77"]
<tbody>[TR]
[TD]Vegetables[/TD]
[/TR]
[TR]
[TD]asparagus[/TD]
[/TR]
[TR]
[TD]green beans[/TD]
[/TR]
[TR]
[TD]spinach[/TD]
[/TR]
[TR]
[TD]broccoli[/TD]
[/TR]
[TR]
[TD]cabbage[/TD]
[/TR]
[TR]
[TD]carrots

[TABLE="width: 122"]
<tbody>[TR]
[TD]Fruits[/TD]
[/TR]
[TR]
[TD]orange,banana[/TD]
[/TR]
[TR]
[TD]pear,apple[/TD]
[/TR]
[TR]
[TD]strawberry[/TD]
[/TR]
[TR]
[TD]peach,blueberries[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]


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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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,223,716
Messages
6,174,069
Members
452,542
Latest member
Bricklin

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