Using an Array formula to Pull Header information from Datasheet

Syncert

New Member
Joined
Apr 19, 2019
Messages
4
Hello all! This is my first post but I've been following this forum a solid 2-4 months in my journeys learning Excel and building dashboards. The resources present on this website have been of immense assistance. I've ran into quite a roadblock on my current project and was wondering if you could shed some insight.

Below is my data table:

Data Table

MonthUsernameOrder #Category 1Category 2Category 3Category 4Category 5Category 6Category 7Category 1 NoteCategory 2 NoteCategory 3 NoteCategory 4 NoteCategory 5 NoteCategory 6 NoteCategory 7 NoteError Count
1/1/1900Kermit45161000010MuppetnonenonenonenoneHensonnone2
2/1/1900Gandolf45170010011nonenoneBalrognonenoneLOTRMoth3
2/1/1900Ozzy45180000011nonenonenonenonenoneIronmanRock2
3/1/1900Bowie45190001111nonenonenoneLabryinthClassicGuitarsRIP4

<tbody>
</tbody>

I've been working towards a format on the main sheet something like this. With the order number repeating the number of error counts:

Main Sheet

MonthOrder #Error CountError TypeError Note
1/1/190045162Category 1Muppet
1/1/190045162Category 6Henson
2/1/190045173Category 3Balrog
2/1/190045173Category 6LOTR
2/1/190045173Category 7Moth
2/1/190045182Category 6Ironman

<tbody>
</tbody>

The Order number repeating was pretty straightforward based upon an array formula of this nature

=IFERROR(INDEX(datasheet!$C$2:$J$10000,SMALL(IF(datasheet!$C$2:$J$10000=1,ROW(datasheet!$C$2:$J$10000)-MIN(ROW(datasheet!$C$2:$J$10000))+1," "),ROW()-2),1)," ")

Using the order # column I can easily index all of the non-dynamic columns onto the main page (i.e Error Count, order month, etc) by adjusting the column number in the INDEX Formula.

What I am having an issue with is getting the Error Type and Error Note columns to dynamically display the error category and error note to match in their respective rows. I've experimented with a few different formulas. Currently on the error type column I'm looking at something like this.

=INDEX(datasheet!$C$1:$J$1,MAX(IF(datasheet!$C$2:$J$10000=1,COLUMN(datasheet!$C$2:$J$10000)-COLUMN(datasheet!$C$1)+1)))

Thus far I havn't been able to toggle it properly to pull the accurate error type from the header column of the datasheet sheet table, and I'm realizing I need to tie it into the order number somehow but make it variable enough that it can be inserted into D1 of the main page

For the Error Note column I was assuming I'd be doing something like an INDEX MATCH MATCH setup referencing the header in some way. Since I'd have the error type and order number present I could easily target the row and column with an INDEX MATCH MATCH setup.

Any insight would be greatly appreciated! Love this forum and love all that you do!!!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
For the Error Type column of the main page I've discovered using this Formula

=IFERROR(INDEX(datasheet!$C$1:$J$1,MATCH(1,INDEX(datasheet!$C$2:$J$15000,MATCH($B2,datasheet!$C$2:$C$15000,0),),0))," ")

Yields the initial Category type. However it doesn't go the extra step and yield more than the first result which is problematic. :(
 
Upvote 0
How about
=INDEX(datasheet!$D$1:$J$1,AGGREGATE(15,6,(COLUMN(datasheet!$D$1:$J$1)-COLUMN(datasheet!$D$1)+1)/((datasheet!$C$2:$C$5=B2)*(datasheet!$D$2:$J$5=1)),COUNTIF($B$2:$B2,$B2)))
 
Upvote 0
OMG it works. I can't thank you enough this has saved me so much time. I've never used the AGGREGATE function before in this fashion. This helping hand has shed a lot of insight into new ways to combine functions.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,602
Members
449,089
Latest member
Motoracer88

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