Extract column data from non-contiguous columns based on header text with duplicate headers

smkyz

New Member
Joined
Sep 16, 2023
Messages
2
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi all,

I am attempting to extract full columns of values only when the column header cell contains specific text in a large matrix where those headers are repeated (due to testing under multiple conditions.)

I have attached an example sheet. I would like to make the measures contiguous (e.g. intensity together, phase together, etc.). I have attempted a combination of Match and Index seen in the sheet, =INDEX($A$3:$I$14,,MATCH($K$17,$A$2:$I$2,0)), but this only works once (or twice with relative referencing) due to the fact that the headers are exactly the same between conditions and it continues to just grab the first instance of matching. Unfortunately, as you can see in the sheet, there is no row identifying the condition with which the repeated measures are associated, so this cannot serve as an additional reference.

Is there anyway to make MATCH pull the position of 2nd, 3rd, 4th, matches and feed that to INDEX, or any other work around for this? Thanks so much for any help.

Examplehelp.xlsx
ABCDEFGHIJKLMNOPQRS
1Q1Q5Q6Q19Q50Q65Q70Q71Q75
2IntensityPhaseLatencyIntensityPhaseLatencyIntensityPhaseLatency
3866658665
4717786390
5878235371
65066553100
7523370096
8639647377
97730103285
10504651373
11557236065
12464464385
13343291087
14518085431
15
16
17IntensityPhaseLatency
188
197
208
215
225
236
247
255
265
274
283
295
Sheet1
Cell Formulas
RangeFormula
K18:K29K18=INDEX($A$3:$I$14,,MATCH($K$17,$A$2:$I$2,0))
Dynamic array formulas.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Welcome to the MrExcel board!

Is this what you are looking for?

23 09 17.xlsm
ABCDEFGHIJKLMNOPQRS
1Q1Q5Q6Q19Q50Q65Q70Q71Q75
2IntensityPhaseLatencyIntensityPhaseLatencyIntensityPhaseLatency
3866658665
4717786390
5878235371
65066553100
7523370096
8639647377
97730103285
10504651373
11557236065
12464464385
13343291087
14518085431
15
16
17IntensityPhaseLatency
18866656685
19773189760
20823737851
215630510650
22530279306
23663347977
247027108335
25563057413
26520536765
27443668445
28320498317
29504183851
Sort
Cell Formulas
RangeFormula
K18:S29K18=SORTBY(A3:I14,MATCH(A2:I2,K17:S17,0))
Dynamic array formulas.
 
Upvote 0
Solution
Welcome to the MrExcel board!

Is this what you are looking for?

23 09 17.xlsm
ABCDEFGHIJKLMNOPQRS
1Q1Q5Q6Q19Q50Q65Q70Q71Q75
2IntensityPhaseLatencyIntensityPhaseLatencyIntensityPhaseLatency
3866658665
4717786390
5878235371
65066553100
7523370096
8639647377
97730103285
10504651373
11557236065
12464464385
13343291087
14518085431
15
16
17IntensityPhaseLatency
18866656685
19773189760
20823737851
215630510650
22530279306
23663347977
247027108335
25563057413
26520536765
27443668445
28320498317
29504183851
Sort
Cell Formulas
RangeFormula
K18:S29K18=SORTBY(A3:I14,MATCH(A2:I2,K17:S17,0))
Dynamic array formulas.
Yes! This worked perfectly. Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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