8.15 Named Ranges with OFFSET (Rolling Charts)
Make the chart remember the latest six months
Imagine you are helping a Pune grocery team review its monthly sales. The manager opens the workbook just before a review and asks if sales have recovered after August. The spreadsheet includes every month since January, and the line chart only has room for six useful labels. At the end of October someone must otherwise edit the chart, remove April, and add October. If they extend the numbers but forget the dates, a real October result might appear under an older month. The job is to give the chart a rule for selecting both together.
The figures in this lesson are fictional practice data for a Blinkit-style local delivery business. The team keeps the history and publishes a view of recent completed months. Think of a camera looking at six marked tiles on a long floor. The whole floor stays in place. When the team approves the next tile, the camera moves one tile forward. A rolling range is the part of a worksheet visible to that camera. A named range gives the chart a stable label for this moving source.
Keep the history, define the window, and make both chart ranges move together. A chart that displays fewer months can still use a complete historical dataset elsewhere in the workbook.
Separate the three different jobs
- Record history. A worksheet stores actual month dates and numeric sales. The verified records are oldest to newest, beginning at a known row. You keep January even when the chart starts in April.
- Define the window. A few helper cells compute the number of rows to show and how far to move from a stable cell. They expose the rule for you to audit before the chart reads it.
- Display the view. A chart takes period labels from one named range and sales from a matched named range. It reports the selected scope in a title or visible caption.
Chapter 8.13 grows a chart as the source Table gains members. That works for a view that should include every approved month. The recent-month view has a different outcome after it reaches capacity. The next data point enters and the oldest visible point leaves. Chapter 8.14 changes the city shown for a fixed timeline. You can eventually combine city and rolling time, but build and verify the time logic with one city first.
Agree on a meaning for “latest”
Latest six completed calendar months normally means six consecutive month labels up to the most recent completed month. Latest six verified records means the final six approved observations, which can span more than six months if some records are missing. A holiday shutdown that really produced zero has a meaningful observation with value zero. A pending sales report has an unknown value. The product decision affects whether you put a placeholder on a calendar axis, show fewer periods or suspend a chart until the gap is resolved.
In the first exercise, each approved row represents a unique, completed calendar month and those rows are consecutive. This gives both interpretations the same answer. Later you will break that assumption deliberately. For a daily report, the same decision might be “seven calendar days” versus “seven operating days.” A rolling chart should tell the reader which interpretation it uses. Comparing a seven-day total from a full week with seven records spread across ten days can make demand look unusually high or low.
Set up dates, amounts and an approval boundary
Enter the same small worksheet before making a chart
Open a desktop Excel copy for the full Name Manager and chart-source exercise. Name the worksheet RollingLab. In A1 and B1 enter Month start and Pune sales in ₹ lakh. In A2 type No verified periods and in B2 enter =NA(). Keep that special row separate from the approved data. It will provide a stable reference when the approved row count is zero. Enter the first nine rows below in A3:B11. Type month start dates suited to your locale or use DATE, then optionally use a display format such as mmm yy. Enter the amounts as plain numbers. The tenth row in the table is for the later append.
| Worksheet row | Month start | ₹ lakh |
|---|---|---|
| 3 | 2026-01-01 | 3.0 |
| 4 | 2026-02-01 | 3.2 |
| 5 | 2026-03-01 | 3.5 |
| 6 | 2026-04-01 | 3.9 |
| 7 | 2026-05-01 | 4.1 |
| 8 | 2026-06-01 | 4.4 |
| 9 | 2026-07-01 | 4.0 |
| 10 | 2026-08-01 | 3.1 |
| 11 | 2026-09-01 | 3.4 |
| 12 | 2026-10-01 | 3.8 |
Rows 3 through 14 hold up to twelve approved periods in this practice design. Keep notes and business comments outside A3:B14. Before approving an append, confirm that the next row is the next completed period, that its date is numeric and on the first of the month, and that the currency figure belongs to that period. If you eventually need a longer approved source, update the capacity and the alternative bounded INDEX ranges together. An input cell indicating thirteen available rows is deliberately rejected by the twelve-slot fixture.
Enter setup labels in E2:E7 so the numbers are readable outside the formula bar. F2 is the number of approved records available, initially 9. F3 is the desired window length, initially 6. F4 is the actual number of data rows to display. F5 is the row offset, F6 is the reference height, and F7 tests whether the inputs are valid. F2 is a manual release gate for this exercise. It does not inspect the cells by itself. A teammate can type October early without releasing it to the chart. Increase F2 only after verifying the next full, adjacent record.
A count can be right while the approved range is wrong
A formula like COUNTA(A:A)-1 can be a convenient count on a carefully designed short worksheet with one header and a clean contiguous list. In this workbook it also counts the fallback text row. It can count a note typed further down and a formula returning empty text. Counting amount cells with COUNT ignores text, but if one approved amount in the middle is blank and later periods have numbers, the count does not locate the last valid row. A count answers how many cells meet conditions. A range also needs to know where those cells live.
Start your audit by tracing the edge of the source. With nine approved records the last approved row is 11, because row 3 is the first data record. Check that neither column has an internal blank or duplicate month. In a growing workflow, you can build a separate approved Table with a validated import, unique period checks, completeness rules and status evidence. Its row count can drive a range after those conditions have been confirmed. For now the manual approval cell intentionally makes a boundary visible to a learner who is still getting comfortable with worksheet coordinates.
Translate the window into rows and height
Work it out before opening the Name Manager
Let N be the approved count and W the desired width in periods. The actual number of periods H is the smaller of N and W for valid settings. If the team wants six months and has only two, display two actual months and call them two. When there are nine and six are requested, H is six. The first approved item to include is record N minus H plus one when records are numbered from one. For nine and six that is record four. January is record one, so the fourth is April. Adding October makes ten approved, and the first is record five, May.
OFFSET starts from a reference and asks how many rows and columns to shift. Positive rows move down and positive columns move right. Then height and width define the rectangle beginning at that shifted location. The stable anchor A2 is immediately above the first data row. Moving down one row reaches record one. Moving down four therefore reaches record four directly. The parallel value range starts at B2. Both references use the same row offset, the same height and a width of one. Matching the range lengths is vital because a point always needs the label for the very same source row.
F7 =IF(COUNT(F2:F3)=2,AND(F2=INT(F2),F2>=0,F2<=12,F3=INT(F3),F3>=1),FALSE)
F4 =IF(F7,MIN(F2,F3),0)
F5 =IF(F4>0,F2-F4+1,0)
F6 =MAX(1,F4)
On each worksheet row type the formula after the cell address. F7 requires numeric whole entries for both counts. The requested window can exceed twelve because the actual size stops at the available N, which is bounded to twelve. The values zero or below for window size, fractional inputs, blank inputs and a verified count above twelve produce invalid settings. F4 becomes zero on bad settings. F5 then points to the fallback rather than to an invented source position. F6 stays positive because OFFSET needs a usable height. If you use a regional list separator such as a semicolon, adapt the displayed formula delimiter to your Excel settings.
If N is zero and W is valid, F7 is TRUE, F4 is zero, F5 is zero and F6 is one. In this special case the range names refer to A2 and B2, the explicit empty-state stub. Exactly one reference exists for the chart binding and no measured number exists. Use a visible No verified periods message. Trying to return a zero-height OFFSET leaves the chart with an invalid range. Setting the stub amount to 0 would make an empty report look like zero sales. A real zero inside a verified source row is still meaningful and should remain numeric.
Name offsets and make the boundary inspectable
Open Formulas → Name Manager → New or the comparable Define Name control. Create LastMonths and LastSales with workbook scope. Workbook scope lets other sheets in the same workbook use the names. A similar local worksheet name could resolve differently, so avoid building duplicates while practising. In the Refers to box enter each complete formula below beginning with its equals sign. Each absolute reference is marked with dollar signs so it keeps pointing at the same worksheet cells regardless of where the name is used.
LastMonths =OFFSET(RollingLab!$A$2,RollingLab!$F$5,0,RollingLab!$F$6,1)
LastSales =OFFSET(RollingLab!$B$2,RollingLab!$F$5,0,RollingLab!$F$6,1)
For the first approved state, F5 is 4 and F6 is 6, so LastMonths is A6:A11 and LastSales is B6:B11. Confirm the names in Name Manager. In a spare area use =ROWS(LastMonths) and =COUNT(LastSales). At this stage both equal 6, but they describe different things. ROWS counts positions in a range. COUNT counts verified numeric entries for this fixture. In the stub state ROWS is 1 while COUNT is 0. For a numeric total that avoids summing an unavailable stub, enter =IF(F4>0,SUM(LastSales),"No verified periods"). A separate validity message should still tell readers if the window settings themselves are wrong.
Make these evidence checks before you edit the chart. If the dates are right and COUNT reports five, verify the amounts in the window instead of accepting a range just because it is six rows tall. Text like an imported currency token can look numeric. A missing amount is particularly easy to overlook when the row is collapsed or its display style hides emptiness. The controlled case predicts exactly six numeric values for six approved periods.
Lab 1. Attach the chart, then roll it forward
Switch from fixed references to the named pair
- Start with a known line. Use the visible April–September data to insert a line with markers. Make the title meaningful, for example “Pune sales · six approved months,” and put the unit ₹ lakh next to it. If Excel creates extra numeric series from dates, inspect the chart using Select Data and set the date labels separately.
- Connect the values. In desktop Excel, select the chart and open Chart Design → Select Data. Select the Pune series and choose Edit. Use a qualified reference to LastSales. If you saved the file as
Rolling Practice.xlsx, Excel may accept='Rolling Practice.xlsx'!LastSalesin Series values. Microsoft's worked example uses a qualified in-workbook sheet form such as=RollingLab!LastSales. Use the form your dialog accepts and inspect what it stores. - Connect the periods. In the same Select Data dialog edit Horizontal Axis Labels and bind
LastMonthswith the corresponding qualifier. Excel can normalize the entered reference after confirmation. Reopen the dialog or inspect the selected series to prove both names were kept. Use the actual filename, spelling and scope rather than copying the example filename into a differently named file. - Check what you can see. Expect April, May, June, July, August, September. The verified amounts total 22.9. April's marker is 3.9, September's marker is 3.4, and August is 3.1. These exact points provide more evidence than a general rising or falling shape.
- Try a pending row. Add the October row in A12:B12 and keep F2 at 9. The approved chart and aligned total should still represent April–September. This workbook separates worksheet entry from approval on purpose.
- Release October. Verify its date and amount, then change F2 to 10. F5 becomes 5, F6 remains 6, the named ranges become A7:A12 and B7:B12, and the chart moves to May–October. The total is 22.8 lakh. The difference is the incoming 3.8 less the departing 3.9.
Read the shape with the data. October is higher than September by 0.4 lakh. The six-month total still falls from 22.9 to 22.8. The two statements can both be true because the total replaces April, while the month-to-month comparison uses September.
Walk through the checks yourself
Follow the three decisions and their evidence
Count the approved source
Nine approved rows begin at row 3 and end at row 11. The October row stays pending while F2 is 9, even if the source sheet shows it.
Set the window
Six requested and nine verified means six data points. The offset from row 2 is four. Both names cover rows 6 to 11.
Advance one month
Set F2 to 10 after verifying October. The offset increases to five, and the height remains six. Both names now cover rows 7 to 12.
Prove the result
October is the final marker at 3.8. The six values total 22.8. A chart showing October under April or showing seven values fails the check.
Exercise the short and empty states
Save a practice copy so you can temporarily alter controls without losing the nine or ten row control state. Set F2 to 2 and F3 to 6. With the first two records still in place the names point to A3:A4 and B3:B4. The chart shows January and February only, COUNT returns 2, and the total is 6.2. Then set F3 to 1. The last period is February, with one value, 3.2. That test helps catch an off-by-one start offset that could disappear when the window is full.
Now set F2 to 0. F7 is still TRUE, and the names should refer to the unmeasured stub. Put the empty-state label in a visible cell. Excel's chart options for empty and error values vary by build and chart type. Check actual markers in the environment where the chart will be used. An ordinary line without markers can hide a one-point zero because there is no segment to see. With line markers or data inspection you can catch that mistaken interpretation. Show the empty-state message and withhold any misleading plot if your chart client cannot display the stub as intended.
Set F2 to 13 to test bad settings and then try a blank or fractional F3. F7 should report FALSE and the controls should yield a harmless reference to the stub. This state needs the message “Check window inputs,” distinct from a valid empty dataset. A helper caption can use the following logic. Include that caption next to the chart, or link a supported chart title to it as in the selector lesson.
=IF(NOT(F7),"Check window inputs",IF(F4=0,"No verified periods","Pune sales · "&F4&" approved month(s)"))
Lab 2. Expose a hidden gap and redesign the evidence
Re-create the count mistake on a separate worksheet
Use a copy and type five records in a fresh area. Label the source as fictional transactions reconciled to month start. Keep a date for every calendar month. Leave the March amount truly blank. The blank represents a ledger file the team has not confirmed. It does not mean zero. The sample deliberately differs in scale from the nine-month story so you can calculate very quickly during debugging.
| Month start | Verified amount | State |
|---|---|---|
| 2026-01-01 | 100 | Verified |
| 2026-02-01 | 120 | Verified |
| 2026-03-01 | Amount pending | |
| 2026-04-01 | 130 | Verified |
| 2026-05-01 | 180 | Verified |
There are four verified numeric amounts. If you feed N equals 4 into the original contiguous-row design with W equals 3, it takes source positions 2–4. You see February, March and April. That includes a blank and leaves out the verified May result. It is wrong both as a current calendar window and as a selection of the latest three verified amounts. A downstream COUNT of those retrieved rows is only two, a new clue that count and position were treated as the same thing.
Choose a policy for the chart before adjusting the formula
- Calendar view. Keep March, April and May as known categories. Leave March's amount marked unavailable. The verified values in that view are 130 and 180 with a subtotal of 310 from two of three months. A chart may show a gap depending on settings. State coverage beside the chart and avoid presenting 310 as a confirmed complete three-month total.
- Verified-observations view. Build a separate clean copy of verified rows in date order. Copy whole date-and-amount pairs for January, February, April and May. With N equals 4 and W equals 3 on this compact list you get February, April and May with verified total 430. Label it “Latest three verified records” and include calendar dates. This view leaves a gap in the span of months represented.
- Complete-through view. If every month in a continuous sequence is required, keep the last approved prefix through February at two full rows. Show that later records are under review. Explain that April and May exist in the raw sheet but the release rule requires a continuous, complete sequence.
On a compatible version you can eventually filter the verified subset from a larger clean range. Use one inclusion condition calculated per source row and apply it to date and amount together. If you filter dates and amounts separately, a missing March amount can pair an April amount with March's label. Handle no qualifying rows explicitly before connecting a dynamic source to a chart. For this exercise, the four-row copy makes the behavior and ordering visible without relying on a feature that can differ across versions.
Try a second edit by replacing March's blank with a verified zero after you have checked its origin. Now there are five valid observations. The latest three complete periods are March, April and May, with values 0, 130 and 180. The total remains 310, but coverage changed from two verified values to three. This is a practical reason to reconcile both sum and count. A manager can now compare a genuinely quiet month against an unknown month on an earlier report without interpreting a matching total as matching evidence.
Check the next date against the last approved date
A numeric test alone can approve a date into the wrong position. A spreadsheet date is stored as a number, and a positive number typed into the date column does not guarantee a sensible reporting month. For an append after September in this exercise, require the actual first day of October 2026. In a helper cell, you can calculate it from the year and the month of the last approved date. Compare the candidate date with that calculation. Decide separately whether the new month's finance report has been signed off.
=IF(COUNT(A11:A12)<>2,FALSE,A12=DATE(YEAR(A11),MONTH(A11)+1,1))
This is a narrow check for the move from row 11 to row 12 and assumes the last approved date is already valid. It should report TRUE for October 1, FALSE for September 1 repeated, FALSE for November 1 which skips a month, and FALSE for an empty A12. The DATE construction handles a move from December 2026 to January 2027 because month 13 advances the year. The two input cells can use different display formats and still compare correctly if their underlying values match. Record the actual month start values in your release log rather than relying on what an abbreviated label looks like.
A practical way to catch a bad sort is to compare the last three pairs before and after approval. Before the October append those rows are July 4.0, August 3.1, September 3.4. After it they are August 3.1, September 3.4, October 3.8. If the labels advance as expected but September moves from 3.4 to 3.1, the problem could be a misaligned sort or a chart range that shifted one month without the other. Restore the affected records from the verified history, then re-run the check. Merely changing the title leaves the misleading result in place.
Preserve comparable views for two teams
Suppose the operations team wants the rolling six months to schedule staff, while finance wants the full calendar history for an annual review. Give the views different chart titles and source labels. The rolling chart focuses on recent movement and intentionally discards history from display. The finance chart can be sourced from the full approved table and compared with the available yearly totals. Both charts can point back to one approved ledger while serving different questions.
Make a duplicate chart in the practice workbook and use the exact January–October data for a full approved history. Its total is 36.4 lakh. The rolling May–October view has 22.8 lakh, leaving January–April's 13.6 lakh outside the six-month window. The two results are expected to differ. A comparison gains meaning if both charts declare the same city, currency and source freshness. When one is refreshed earlier, the reader also needs to see that time difference.
Keep your release record nearby so another beginner could repeat the update independently. Write the previous approved cutoff, the candidate month, its verified number, the expected first new month and the expected total. That short trail gives the next student a place to start when a view seems out of date. A workbook can contain an October row, a September approved date, and a chart still on August because its series have fixed references. Checking each stage separately identifies which transition failed.
Build a second equivalent range with INDEX
Use two cell references as endpoints
When you give INDEX a range and a positive position, it can provide a cell reference usable in a range expression. Put a colon between two INDEX expressions to name a continuous interval from the first cell to the last. The helper F5 is a zero-based offset relative to the anchor row. INDEX into the list starting at A2 counts row A2 as position one, so start at F5 plus one. The ending position is F5 plus F6. If the start is five and height is six, the final position is ten. Those two positions are both within the bounded reference A2:A14 in the practice workbook.
LastMonthsIndex =INDEX(RollingLab!$A$2:$A$14,RollingLab!$F$5+1):INDEX(RollingLab!$A$2:$A$14,RollingLab!$F$5+RollingLab!$F$6)
LastSalesIndex =INDEX(RollingLab!$B$2:$B$14,RollingLab!$F$5+1):INDEX(RollingLab!$B$2:$B$14,RollingLab!$F$5+RollingLab!$F$6)
At N equals 9, W equals 6, F5 equals 4 and F6 equals 6. In A2:A14, positions 5 to 10 are worksheet rows A6:A11. After approving October the positions are 6 to 11, rows A7:A12. With zero approved records the positions are both 1, the fallback row. Try those states using both pairs of names. Compare ROWS, COUNT and the verified sum. Use two names at once in the chart because substituting one while leaving the other on a different window is hard to notice visually.
OFFSET is volatile, so Excel recalculates it whenever the workbook recalculates. Microsoft describes INDEX as a way to reduce the use of volatile OFFSET in dynamic references. A few small ranges may feel quick in a classroom example. Large sheets with many dependent formulas and chart sources can pay a noticeable recalculation cost. Measure a real workbook's recalculation and change one design choice at a time if performance is a problem. Switching calculation to manual can leave published results stale. Treat calculation mode as part of the evidence when a chart fails to update.
Debug one layer at a time when the chart behaves strangely
- Wrong dates or amount count. Verify F2 through F7, date types and the exact first and last worksheet rows. Check whether the source was sorted as whole pairs and whether pasted values replaced formulas or labels.
- Range seems right, chart stalls. Reopen Select Data. Check both named definitions, scope and the particular chart series. Confirm that you are looking at the editable workbook rather than a pasted picture or exported static view.
- An unexpected spike or zero. Inspect the source value, the numeric COUNT and missing-cell display rules. A zero might be a valid measured result or an accidentally introduced placeholder. Compare with the verified evidence table.
- Labels shift or seem too dense. Check whether the x-axis is using the intended date or category behavior and whether the names match. Choose a readable date display with year included when the window crosses January. Confirm the exported display after reopening.
- A name changes in one copy but stays fixed in another. Check the saved workbook name and qualification. An individual copied chart may still refer to its original source. Make a controlled edit in the copy and observe where the chart reacts.
Try timing a release in your own workbook. Save the approved nine-month version with 22.9 and capture its caption. Before your next refresh, explain the incoming and outgoing periods to a friend. Then perform the real workbook update and record the actual ranges and values. You can reuse this simple change log when fixing a report a few months later. It answers what was live at a particular review even after the rolling window has moved on again.
Pause before sharing the workbook and ask a classmate to identify the latest measured month without opening a dialog. Give them the title, the period labels, the unit and the approval count that's already on the page. If they answer with the latest calendar month instead of the last approved month, revise the scope label and repeat the exercise. It is a quick check of whether the chart explains its evidence on its own.
Check your understanding
Five practice questions with answers
You need six periods and have two approved periods. What is the correct data-window height?
Two. The display length is the smaller of the request and the approved count. The missing four periods do not become zeros, and the scope should say two approved periods.
Which rows does N equals 10 and W equals 6 name when the anchor is row 2?
The row offset is five and height is six. Starting at row 7, take rows 7 through 12. Months and values then both use that same set of rows.
Why is the reference height one when the number of approved periods is zero?
A genuine chart range must reference cells. In the empty state we use a clearly marked stub row containing an unavailable value, while the actual data count remains zero.
Does a lower six-month total prove the final month has fallen from last month?
No. In this example October at 3.8 exceeds September at 3.4. The rolling total compares October with the April value 3.9 that dropped out, making the new total lower by 0.1.
Which gap view gives 430 and what should it be called?
The last three verified observations. It includes February, April and May. The March–May calendar view has only two known values totalling 310. The name keeps readers from comparing two different scopes as if they were the same date interval.
Five interview questions with worked explanations
How do you keep history while showing the latest six months?
Retain the validated history separately. Calculate the rolling start and height in dedicated cells and bind a date name and amount name built from the same controls. Test with a known append and a known amount that leaves the window.
How do you diagnose a moving values range and a frozen labels range?
Inspect each source binding in Select Data. Compare the first and last row of both names against the intended worksheet records. Correct the period reference to the period name using the same shift and height as the sales range. Confirm the last marker reads October and 3.8 together.
How would you prove the count-based shortcut is safe?
Confirm that every approved row forms a single contiguous sequence from the anchor with complete aligned dates and numeric amounts, and that any counted range excludes headers, notes, stub rows and optional material. Validate unique periods and order. Then check both a controlled append and an intentional gap.
Why use INDEX for the naming alternative?
Two INDEX expressions joined by a colon refer to precise cell endpoints and avoid OFFSET's volatility. It addresses recalculation behavior while preserving the expected checked periods. The same boundaries and fallback policy still need correct design.
What would you show if original records include a genuine zero and an unverified amount?
I would use a verified numeric zero for the measured month and an explicit missing state for the unverified month. I would reconcile verified count and period coverage, then test chart behavior with a marker and caption so the known zero stays visible as measured data.
Revision cards
- History versus window. Preserve approved rows. Move the visible sample by policy.
- Three controls. Available count N, requested W, actual height H.
- Matching ranges. Same offset and height for dates and values.
- Empty scope. One fallback reference, zero measured values, explicit status.
- Continuity check. A record count does not locate an internal missing row.
- Release check. Name the dates entering and leaving and recompute the result.
Use the Excel Task Hub for extra range and date exercises, or continue to the checkbox-driven chart for a different kind of control.