Replacing INDEX(INDIRECT(DYNAMICCELL)

xtrato

New Member
Joined
Sep 14, 2016
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hello all, im new to posting but certainly not to the forums!

IN any case , i have a quite a pickle - so a run retail stores with a lot of raw data , i have created a sheet to track that data on a daily basis - and i've created "Monthly Workbooks"

In each workbook i have sheets from 1-30 or 31 to represent the day of the month ! - as to happens to all - this sheet grew and now its practically running all raw data ;

so i have a different sheet where i keep track of SPECIFIC targeted data , this data is presented and stored as shown the picture

1692723181619.png


each cell you see here References the Sheetnumber Say 1,2,3,4 etc , and this is used throughout other sheets, the formula IN C5 is:


Code:
=IFERROR(INDEX(INDIRECT("'"&C$3&"'!NX1:QD300"),XMATCH($B5,INDIRECT("'"&C$3&"'!NY1:NY300")),XMATCH($B$2,INDIRECT("'"&C$3&"'!NX1:QD1"))),0)

IN D5 is:

Code:
=IFERROR(INDEX(INDIRECT("'"&D$3&"'!NX1:QD300"),XMATCH($B5,INDIRECT("'"&D$3&"'!NY1:NY300")),XMATCH($B$2,INDIRECT("'"&D$3&"'!NX1:QD1"))),0)

and so on going left and right - the references are DYNAMIC - it is like that throughout the entire workbook - how can i use VBA to replace such monstrosity for i have thousands of these formals and my workbook is now a slowpoke.

Thank you all!!

I also Posted this on EXCELFORUMS ; but no help yet: hopefully i can get direction.

 
Last edited by a moderator:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Daily_EXAMPLE.xlsm
BCDEF
1date1/1/20231/2/20231/3/20231/4/2023
2NetAct1234
3acctotal1234
41TRUEFALSEFALSEFALSE
5LPMA3402000
6LPMA5060000
7LPNJ8525000
8LPNY3691000
9LPMA3760000
Boxes
Cell Formulas
RangeFormula
B4B4=COUNTIF(C4:AH4,TRUE)
C4:F4C4=ISREF(INDIRECT("'"&C3&"'!A1"))
C5:E5,C7:F9,F5:F6,C6:D6C5=IFERROR(INDEX(INDIRECT("'"&C$3&"'!NX1:QD300"),XMATCH($B5,INDIRECT("'"&C$3&"'!NY1:NY300")),XMATCH($B$2,INDIRECT("'"&C$3&"'!NX1:QD1"))),0)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C5:AG10,C12:AG151,D11:AG11Cell Valuecontains "HIt"textNO
C3:AI3Cell Valuecontains "HIt"textNO
C2:BN2Cell Valuecontains "HIt"textNO
B2Celldoes not contain a blank value textNO
B2Celldoes not contain a blank value textNO
B1,CW9,B3,B5:B76,B4:AG4,AH5:AH151Cell Valuecontains "HIt"textNO
 
Upvote 0
Hi , good afternoon , does anyone have any tips on this matter?

Or referencing an Dynamic cell without using INDIRECT?
 
Upvote 0
Could be done with VBA ofcourse. But we need your workbook.
 
Upvote 0
Saw your file on Excelforum, I gave a solution there
 
Upvote 0
Please post your solution here as well. Thanks
 
Upvote 0
Sure, no problem ofcourse!

VBA Code:
Sub jec()
 Dim xp, ar, a, j As Long, jj As Long, jjj As Long
 xp = Range("B3:AG" & Range("B" & Rows.Count).End(xlUp).Row)
 
 For j = 2 To UBound(xp, 2)
   If Evaluate("isref('" & xp(1, j) & "'!A1)") Then
      ar = Sheets(xp(1, j)).Range("NX1:QD300")
      For jj = 3 To UBound(xp)
        For jjj = 1 To UBound(ar)
          If xp(jj, 1) = ar(jjj, 2) Then
            a = Application.Match(Range("B2"), Application.Index(ar, 1, 0), 0)
            If IsNumeric(a) Then
              xp(jj, j) = ar(jjj, a)
              Exit For
            End If
          End If
        Next
      Next
   End If
 Next
 
 Range("B3:AG" & Range("B" & Rows.Count).End(xlUp).Row) = xp
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,092
Messages
6,123,064
Members
449,090
Latest member
fragment

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