How to define range based on another cell value in Excel?
To calculate a range of values is easy for most of Excel users, but have you ever tried to calculate a range of values based on the number in a specific cell? For example, there is a column of values in column A, and I want to calculate the number of values in column A based on the value in B2, which means that if it is 4 in B2, I will average the first 4 values in column A as below screenshot shown. Now I introduce a simple formula to quickly define range based on another cell value in Excel.
Define range based on cell value
Define range based on cell value
To do calculation for a range based on another cell value, you can use a simple formula.
Select a blank cell which you will put out the result, enter this formula =AVERAGE(A1:INDIRECT(CONCATENATE("A",B2))), and press Enter key to get the result.
1. In the formula, A1 is the first cell in the column you want to calculate, A is the column you calculate for, B2 is the cell you calculate based on. You can change these references as you need.
2. If you want to do summary, you can use this formula =SUM(A1:INDIRECT(CONCATENATE("A",B2))).
3. If the first data you want to define is not in first row in the Excel, for instance, in cell A2, you can use the formula as this: =AVERAGE(A2:INDIRECT(CONCATENATE("A",ROW(A2)+B2-1))).
Quickly Count/Sum cells by background or format color in Excel |
In some cases, you may have a range of cells with multiple colors, and what you want is to count/sum values based on same color, how can you quickly calculate? With Kutools for Excel's Count by Color, you can quickly do many calculations by color, and also can generate a report of the calculated result. Click for free full featured trial in 30 days! |
![]() |
Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. |
Best Office Productivity Tools
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need Is Just A Click Away...
Supercharge Your Spreadsheets: Experience Efficiency Like Never Before with Kutools for Excel (Full-Featured 30-Day Free Trial)
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!





















