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. Download Kutools and try it today! |
Kutools for Excel - Supercharge Excel with over 300 essential tools. Enjoy permanently free AI features! Get It Now |
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
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!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.





- All-in-one suite ā Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license ā set up in minutes (MSI-ready)
- Works better together ā streamlined productivity across Office apps
- 30-day full-featured trial ā no registration, no credit card
- Best value ā save vs buying individual add-in