Index Match or VBA Assistance

Bwiles96

New Member
Joined
Apr 5, 2022
Messages
16
Office Version
  1. 365
Platform
  1. Windows
*** I was unable to get the L2BB to work so the best I can do is provide screenshots and I apologize for that. ***


I have two sheets, one labeled "Stored Data" and one labeled "Output"

  • What I am needing is to find the intersection of Batch Ticket# 1 and Test 1 (in this instance it would be 9) from the 'Stored Data' spreadsheet and return that value (again, 9) to the row of the batch ticket on the 'Output'

Can't get any formula I've tried to work so I am happy to use VBA or a formula or whatever magic works at this point. I am at a loss here.

Sheets Below:

Stored Data:

1702565473661.png


Output:
1702565426467.png
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
This is the closest I could come to getting a formula based on the odd format of the data you're trying to retrieve. Can you not combine those tables into one on the stored data sheet?

Book2
ABCDEF
1Batch Ticket #Test 1Test 2Test 3Test 4Test 5
21910111213
321415161718
431920212223
542425262728
652930313233
763435363738
873940414243
98444546448
Output
Cell Formulas
RangeFormula
B2:F5B2=IFERROR(INDEX('Stored Data'!$C$3:$F$7,MATCH(Output!B$1,'Stored Data'!$B$3:$B$7,0),MATCH(Output!$A2,'Stored Data'!$C$1:$F$1,0)),"")
B6:F9B6=IFERROR(INDEX('Stored Data'!$C$14:$F$18,MATCH(Output!B$1,'Stored Data'!$B$14:$B$18,0),MATCH(Output!$A6,'Stored Data'!$C$12:$F$12,0)),"")
 
Upvote 1
try this on a copy of your sheet.

VBA Code:
Sub do_it()
For p = 1 To 12 Step 11 'adjust range as needed
    For c = 3 To 6 ' batch numbers
        For test = p + 2 To p + 6 'each test
            Worksheets("Output").Cells(Cells(p, c).Value + 1, test - p) = Cells(test, c)
        Next test
    Next c
Next p
End Sub
 
Upvote 1
Solution
This is the closest I could come to getting a formula based on the odd format of the data you're trying to retrieve. Can you not combine those tables into one on the stored data sheet?

Book2
ABCDEF
1Batch Ticket #Test 1Test 2Test 3Test 4Test 5
21910111213
321415161718
431920212223
542425262728
652930313233
763435363738
873940414243
98444546448
Output
Cell Formulas
RangeFormula
B2:F5B2=IFERROR(INDEX('Stored Data'!$C$3:$F$7,MATCH(Output!B$1,'Stored Data'!$B$3:$B$7,0),MATCH(Output!$A2,'Stored Data'!$C$1:$F$1,0)),"")
B6:F9B6=IFERROR(INDEX('Stored Data'!$C$14:$F$18,MATCH(Output!B$1,'Stored Data'!$B$14:$B$18,0),MATCH(Output!$A6,'Stored Data'!$C$12:$F$12,0)),"")
This is the closest I could come to getting a formula based on the odd format of the data you're trying to retrieve. Can you not combine those tables into one on the stored data sheet?

Book2
ABCDEF
1Batch Ticket #Test 1Test 2Test 3Test 4Test 5
21910111213
321415161718
431920212223
542425262728
652930313233
763435363738
873940414243
98444546448
Output
Cell Formulas
RangeFormula
B2:F5B2=IFERROR(INDEX('Stored Data'!$C$3:$F$7,MATCH(Output!B$1,'Stored Data'!$B$3:$B$7,0),MATCH(Output!$A2,'Stored Data'!$C$1:$F$1,0)),"")
B6:F9B6=IFERROR(INDEX('Stored Data'!$C$14:$F$18,MATCH(Output!B$1,'Stored Data'!$B$14:$B$18,0),MATCH(Output!$A6,'Stored Data'!$C$12:$F$12,0)),"")
Unfortunately I cannot. I simplified my actual document.

The tests are all different names - things like A-123-B & D-1298-2.

I changed them to test names "Test1" for simplicity and to not confuse anyone.

Basically each product type has it's own specific tests so I have to break it up this way

But I appreciate the formula. I should be able to modify it to my needs on my sheets

Big help - thanks Jeffrey!
 
Upvote 0
try this on a copy of your sheet.

VBA Code:
Sub do_it()
For p = 1 To 12 Step 11 'adjust range as needed
    For c = 3 To 6 ' batch numbers
        For test = p + 2 To p + 6 'each test
            Worksheets("Output").Cells(Cells(p, c).Value + 1, test - p) = Cells(test, c)
        Next test
    Next c
Next p
End Sub
This works wonderfully as well. Thank you @rpaulson. Now I just need to figure out how to amend it to match my actual sheet! Lol
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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