CHOOSE function with multiple tables and multiple columns

nbowland

New Member
Joined
Mar 8, 2016
Messages
4
I am trying to complete a form that extracts information from multiple tables with several columns. The column index is rarely the same, so I can't just hard code a column index number. I tried using the INDEX with MATCH functions to replace the column index number, but #VALUE error appeared. Does anyone know how to extract from multiple tables with several columns? Thank you.

-Nick
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
The column index is rarely the same, so I can't just hard code a column index number.
Can you post the formula you would use if that wasn't an issue?
i.e. If the columns never changed, and you 'could' hard code the column index #.
 
Upvote 0
Hi Bryan,

Thank you for the response! Below is the most current code I tried...

=CHOOSE(I5,INDEX(G14:L18,MATCH(G2,F14:F18,0),MATCH(H4,G13:L13,0)),INDEX(G22:L26,MATCH(G2,F22:F26,0),MATCH(H4,G21:L21,0)))

I also used this code with the actual Index #. It worked, but I can't use this without hard-coding every cell to pull from a different column...

=VLOOKUP(G2,CHOOSE(D17,F14:AD18,F22:AD26,F30:AD34),3,0)
 
Upvote 0
So is each range like a duplicate of each other, as far as the row and column headers go ?
i.e. Is F14:F18 the same as F22:F26 ?
and is G13:L13 the same as G21:L21 ?
 
Upvote 0
If the Row and Column headers are the same in each 'section', try
=INDEX(OFFSET($G$14:$L$18,(I5-1)*8,0),MATCH(G2,$F$14:$F$18,0),MATCH(H4,$G$13:$L$13,0))

If the headers are unique in each 'section', try
INDEX(OFFSET($G$14:$L$18,(I5-1)*8,0),MATCH(G2,OFFSET($F$14:$F$18,(I5-1)*8,0),0),MATCH(H4,OFFSET($G$13:$L$13,(I5-1)*8,0),0))
 
Upvote 0
Thank you. I tried the latter formula, as the headers are unique. It didn't quite work though. Is there a way that I could send you the workbook?
 
Upvote 0
No we like to keep the conversation in the forum.

You might upload it to a filesharing site like dropbox or something.

Otherwise, try using an HTML tool to post nicely formatted tables from your sheet to the forum
See my signature for a link.
 
Upvote 0
Here's an example of it working with Just 2 sections of the tables.


Unknown
EFGHIJKL
2224H
3
49
52
6
7
8
9
10
11
12
13123456
14A2869387350
15B223662979099
16C62329014532
17D7057353366100
18E74325783273
19
20
21789101112
22F245217243281235244
23G242210240252260299
24H277209224243280203
25I263234203300223227
26J222253255254228212
Sheet1
Cell Formulas
RangeFormula
E2=INDEX(OFFSET($G$14:$L$18,(I5-1)*8,0),MATCH(G2,OFFSET($F$14:$F$18,(I5-1)*8,0),0),MATCH(H4,OFFSET($G$13:$L$13,(I5-1)*8,0),0))
 
Upvote 0
I really appreciate you help! I need to research the OFFSET function so that I understand exactly how it fits into the formula. If I can't, I will copy / paste a piece of the worksheet for you. Again, your time is greatly appreciated!
 
Upvote 0
Hi nbowland,
Can you use something like this. I have incorporated the choose function to allow flexibility to select table and match ranges.
Mike Szczesny

Excel 2012
ABCDEF
1Table #2
2Column x
3Row d
4Number29
5
6Table1xxxxxxxxxx
7a1234
8b5678
9c9101112
10d13141516
11
12
13Table2xxxxxxxxxx
14a17181920
15b21222324
16c25262728
17d29303132
18
19
2029

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
B4=A20
A20=INDEX(CHOOSE($B$1,$C$7:$F$10,$C$14:$F$17),MATCH(B3,CHOOSE($B$1,$B$7:$B$10,$B$14:$B$17),0),MATCH($B$2,CHOOSE($B$1,$C$6:$F$6,$C$13:$F$13),0))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,216,058
Messages
6,128,538
Members
449,456
Latest member
SammMcCandless

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