Indirect function is making excel file very slow.

MandeepBajimaya

New Member
Joined
Jun 2, 2021
Messages
20
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have an excel file which has 200 sheets for inventory items. These are for multiple companies on same sheet . I have to prepare summary for these items in the first sheet. Since I have used a lot of indirect function, it is making file very slow. What can I do to make it faster?



Screenshot 2023-01-03 153740.png
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Are you familiar with VBA? You could use a VBA solution to either:

  • Populate the data using VBA instead of formulas. Would need to be refreshed whenever any data changes.
  • Populate hard-coded formulas using VBA instead of INDIRECT. Would need to be refreshed if you add new worksheets

I would need to understand how the column maps to what cell on the worksheet you want to reference.
 
Upvote 0
Are you familiar with VBA? You could use a VBA solution to either:

  • Populate the data using VBA instead of formulas. Would need to be refreshed whenever any data changes.
  • Populate hard-coded formulas using VBA instead of INDIRECT. Would need to be refreshed if you add new worksheets

I would need to understand how the column maps to what cell on the worksheet you want to reference.
Hi there,

I am not aware of VBA.
The sheet has same headings for all items, i.e., company name in heading and quantity as table.
The summary sheet has total issues of all items for each company.
 
Upvote 0
The example above refers to AG1000 on the other sheet. How do you determine which cell to reference for each column?
 
Upvote 0
The example above refers to AG1000 on the other sheet. How do you determine which cell to reference for each column?
It is continuous like AG1000, then to the right it's AH1000, then AI1000 and so on. Here, the variable is name of sheet but column reference for every sheet is same
 
Upvote 0
So all the referenced data on every sheet is always in row 1000?
 
Upvote 0
This sub will create all of the formulas. Please ask if you need details about how to install the code and how to run it.

VBA Code:
Sub SetFormulas()

   Dim Row As Long, Column As Long
   Dim LastRow As Long
   Dim LastColumn As Long
   Dim RelativeFormula As String
   
   LastRow = Cells(Rows.Count, "D").End(xlUp).Row
   LastColumn = Cells(6, Columns.Count).End(xlToLeft).Column
   For Row = 8 To LastRow
      RelativeFormula = "='" & Cells(Row, "D") & "'!R1000C[28]"
      Range(Cells(Row, "E"), Cells(Row, LastColumn)).FormulaR1C1 = RelativeFormula
   Next Row
   
End Sub
 
Upvote 0
This sub will create all of the formulas. Please ask if you need details about how to install the code and how to run it.

VBA Code:
Sub SetFormulas()

   Dim Row As Long, Column As Long
   Dim LastRow As Long
   Dim LastColumn As Long
   Dim RelativeFormula As String
  
   LastRow = Cells(Rows.Count, "D").End(xlUp).Row
   LastColumn = Cells(6, Columns.Count).End(xlToLeft).Column
   For Row = 8 To LastRow
      RelativeFormula = "='" & Cells(Row, "D") & "'!R1000C[28]"
      Range(Cells(Row, "E"), Cells(Row, LastColumn)).FormulaR1C1 = RelativeFormula
   Next Row
  
End Sub
I have added this code inside Module of the sheet from Developer tab. But I am not aware how to use it.
 
Upvote 0
Probably the easiest way to use it is to add a module. Right click on the project and select Insert > Module. It will be called Module1. Then add this code

VBA Code:
Public Sub RefreshIndex()

   Worksheets("Index").SetFormulas

End Sub

From the Developer tab select Macros, click on RefreshIndex from the list, and click Run.
 
Upvote 0

Forum statistics

Threads
1,215,352
Messages
6,124,457
Members
449,161
Latest member
NHOJ

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