Excel

TheSmallman.com

an XL ideas Lab

Dashboards VBA
  • Home
  • Dashboards
    • Tips & Tricks
    • Charts
    • Modelling
    • Infographics
    • VBA
  • Shop Dashboards
    • Power Pivot a User Guide
    • Excel Dashboard Course
    • Advanced Dashboard Course
    • Financial Modelling Course
    • Excel VBA Course
  • Blog
  • About
Menu

Excel Dashboards VBA

Street Address
City, State, Zip
Phone Number
an XL ideas Lab

Your Custom Text Here

Excel Dashboards VBA

  • Home
  • Dashboards
  • Excel Tips
    • Tips & Tricks
    • Charts
    • Modelling
    • Infographics
    • VBA
  • Shop Dashboards
  • PowerPivot
    • Power Pivot a User Guide
  • Courses
    • Excel Dashboard Course
    • Advanced Dashboard Course
    • Financial Modelling Course
    • Excel VBA Course
  • Blog
  • About

Using Index as a Dynamic Range

April 30, 2019 Marcus Small
Dynamic Range Excel

Traditionally I have used the OFFSET function for dynamic ranges within Excel. It is solid and gets the job done on a given range. One thing to remember when using OFFSET is to ensure you include a big enough row count for vertical ranges. It works really nicely on a tabular data sets. If you are unfamiliar the following is an example of a dynamic range with a AVERAGE formula:

=AVERAGE(OFFSET(B2,,,COUNTA(B2:B90)))

However, there is another method for trapping dynamic ranges, let’s say we want the AVERAGE for the cells in column B and the likelihood that column B will grow is extreme. The same formula can be written as follows:

=AVERAGE(B2:INDEX(B2:B90,COUNTA(B2:B90)))

While the formula is longer (by 4 characters) it has the added advantage of being a non volatile formula. If there are too many Volatile formula in a spreadsheet it can start to chug a bit.

Breaking the formula down cell B2 is where the formula range starts, the INDEX formula comes to the party where it creates the second cell reference in Column B. It looks at the range between B2 and B90 and is looking for a specific Row number in the first instance. Enter the COUNTA formula which acts as the solution for which Row number. Counta counts all of the cells that have data in a given range. Blanks are not included. So if the data stops in A15 then all of the data from B2:B15 are included in the AVERAGE. It is a master stroke and keeps things non volatile.

Try it with your own data. Here is a workbook that displays both techniques.

INDEX.xlxs




Tags Excel, Index, Offset, Dynamic, Ranges, Dynamic formula
← Excel Now Has 3D PicturesAdvanced Excel Skills →

Featured Posts

Excel Dashboards: Tracking a Crisis

Excel Dashboards: Tracking a Crisis
April 14, 2020

Recent Posts

Populating an Excel Table from a Range of Cells with VBA

Populating an Excel Table from a Range of Cells with VBA June 12, 2025

Fuzzy Distribution with Randbetween

Fuzzy Distribution with Randbetween May 21, 2025

Add Minimum and Maximum for Chart in Cells

Add Minimum and Maximum for Chart in Cells March 12, 2025

Inflation Over Multiple Years in a Single Cell

Inflation Over Multiple Years in a Single Cell January 10, 2025

Hubspot Dashboard

Hubspot Dashboard October 3, 2024

Monthly Dashboard With Supporting Metrics

Monthly Dashboard With Supporting Metrics September 25, 2024

Excel Show Missing Sheet Tabs

Excel Show Missing Sheet Tabs July 29, 2024

Run Macro Overnight Automatically

Run Macro Overnight Automatically June 24, 2024

Split File into Parts and Save to Directory

Split File into Parts and Save to Directory April 20, 2024

Most Popular Author

Most Popular Author December 14, 2023

 

Follow US:

 
 

MarcusSmall@thesmallman.com

 

TheSmallman.com - Making your small systems hum...
© Copyright 2013-2024 theSmallman.com All Rights Reserved.