You can hit a severe cash crunch during your highest-revenue quarter. Accrual profit and loss statements count invoices the day they are issued, masking liquidity traps caused by Net-30 or Net-60 payment terms. While your monthly P&L looks profitable, fixed obligations like payroll, cloud infrastructure costs, and rent arrive strictly on schedule.
A 13-week rolling cash flow forecast resolves this mismatch. By mapping expected cash receipts and payments over a one-quarter horizon, you shift focus from accounting profitability to immediate bank balances. Managing liquidity on a single-currency, weekly date-range basis allows you to spot shortfalls early enough to defer non-essential expenses or follow up on late receivables.
Step 1: Structure Your Inputs With Real Dates and Single-Currency Filtering
To build a reliable forecast, separate model control parameters from transactional data. Avoid hardcoding assumptions inside formulas.
On your primary layout sheet, named Cash_Flow_13_Week, establish a global configuration block:
| Cell Address | Label | Parameter / Formula | Description |
|---|---|---|---|
$B$2 | Starting Cash Balance | 25000 | Current aggregate bank balance |
$B$3 | As-Of Date | 2026-12-01 | Forecast start baseline date |
$B$4 | Base Currency | "USD" | Currency filter tag |
$D$2 | Overdue Lag Days | 14 | Expected delay for past-due receivables |
Next, structure your accounts receivable tab, Invoices_AR. Ensure all entries store explicit date values rather than text:
- Column C:
currency(e.g.,USD) - Column D:
issue_date(Format:YYYY-MM-DD) - Column E:
due_date(Format:YYYY-MM-DD) - Column G:
amount(Invoice total) - Column H:
amount_paid(Partial collections) - Column I:
balance_duecalculated as:
=G2-H2 - Column K:
aging_bucketevaluated against the control date:
=IFS(I2<=0, "Paid", E2>=$B$3, "Current", $B$3-E2<=30, "1-30 Days", $B$3-E2<=90, "31-90 Days", TRUE, "90+ Days Overdue") - Column L:
adjusted_expected_dateto route overdue items into active forecast weeks:
=IF(I2<=0, "", IF(E2<$B$3, MAX(E2+$D$2, $B$3), E2)) For accounts payable (Expenses_AP), store expense due dates and apply identical logic: set adjusted_due_date to:
=MAX(due_date, Cash_Flow_13_Week!$B$3) This ensures unpaid past-due bills collapse into Week 1 rather than dropping out of the cash model.
Step 2: Formula-Driven Weekly SUMIFS
With transaction schedules established using valid dates, you can build dynamic weekly roll-ups. Avoid manual value entry or text-based date hacks like using YYYY-MM* wildcards on date columns, as standard date numbers render wildcard text matching ineffective in modern spreadsheet engines.
On Cash_Flow_13_Week, configure your 13-week timeline grid starting in row 6:
- Week 1 Start (
B7):=$B$3 - Week 1 End (
C7):=B7+6 - Week 2 Start (
B8):=C7+1 - Week 2 End (
C8):=B8+6
Copy the relative sequence across rows 9 through 19 to complete the 13-week grid.
+-----------------------------------------------------------------------------------------+ | 13-WEEK GRID LAYOUT | +--------+------------------+------------------+--------------------+---------------------+ | Week | Start Date | End Date | Base Inflow | Base Outflow | +--------+------------------+------------------+--------------------+---------------------+ | Week 1 | = $B$3 | = B7 + 6 | [SUMIFS Formula] | [SUMIFS Formula] | | Week 2 | = C7 + 1 | = B8 + 6 | [SUMIFS Formula] | [SUMIFS Formula] | | ... | ... | ... | ... | ... | | Week 13| = C18 + 1 | = B19 + 6 | [SUMIFS Formula] | [SUMIFS Formula] | +--------+------------------+------------------+--------------------+---------------------+ To aggregate projected cash inflows for Week 1 without hardcoding values, enter this formula in cell D7:
=SUMIFS(Invoices_AR!$I$2:$I$200, Invoices_AR!$C$2:$C$200, $B$4, Invoices_AR!$L$2:$L$200, ">="&B7, Invoices_AR!$L$2:$L$200, "<="&C7) Calculate expected cash outflows for Week 1 in cell E7 using:
=SUMIFS(Expenses_AP!$F$2:$F$200, Expenses_AP!$D$2:$D$200, $B$4, Expenses_AP!$H$2:$H$200, ">="&B7, Expenses_AP!$H$2:$H$200, "<="&C7) If monthly reporting is required alongside weekly grids, add a dedicated helper column to your source sheets that explicitly converts real dates to text format:
=TEXT(due_date, "yyyy-mm") You can then run precise SUMIFS queries against this helper string instead of using risky wildcard syntax.
Step 3: Realistic Timing Scenarios & Python Automation
A common modeling mistake when creating scenario projections is applying percentage multipliers directly to billed amounts—such as assuming an "upside scenario = 115% of revenue." You cannot collect 115% of an issued invoice balance. Real cash flow volatility stems from payment timing shifts and bad debt write-offs, not phantom invoice volume.
To build valid forecast scenarios, adjust payment timing assumptions instead:
- Base Scenario: Overdue balances between 1–90 days shift forward by +14 days; invoices 90+ days late are treated as uncollectible bad debt.
- Downside Scenario: +14 days extra delay plus a 20% haircut on all receivables.
- Upside Scenario: All clients pay strictly on their due date with zero payment lag.
To automate aging analysis and identify cash balance risks below your reserve threshold, run this self-contained Python script:
from datetime import datetime, timedelta from decimal import Decimal, ROUND_HALF_UP def analyze_cash_flow(as_of_str, starting_cash, min_buffer, invoices, weekly_outflows, scenario="Base"): as_of = datetime.strptime(as_of_str, "%Y-%m-%d") aging_summary = {"Current": Decimal("0.00"), "1-30": Decimal("0.00"), "31-90": Decimal("0.00"), "90+": Decimal("0.00")} # 1. Bucket Accounts Receivable for inv in invoices: due = datetime.strptime(inv["due_date"], "%Y-%m-%d") balance = inv["amount"] - inv["paid"] if balance <= Decimal("0.00"): continue days_overdue = (as_of - due).days if days_overdue <= 0: aging_summary["Current"] += balance elif days_overdue <= 30: aging_summary["1-30"] += balance elif days_overdue <= 90: aging_summary["31-90"] += balance else: aging_summary["90+"] += balance # 2. Project 13-Week Cash Balances current_cash = starting_cash low_cash_warnings = [] for wk in range(1, 14): wk_start = as_of + timedelta(days=(wk - 1) * 7) wk_end = wk_start + timedelta(days=6) # Collect inflows matching adjusted payment window wk_inflow = Decimal("0.00") for inv in invoices: balance = inv["amount"] - inv["paid"] if balance <= Decimal("0.00"): continue due = datetime.strptime(inv["due_date"], "%Y-%m-%d") days_overdue = (as_of - due).days if scenario == "Base": if days_overdue > 90: continue adj_due = max(due + timedelta(days=14), as_of) if due < as_of else due effective_balance = balance elif scenario == "Downside": adj_due = max(due + timedelta(days=14), as_of) if due < as_of else due + timedelta(days=14) effective_balance = (balance * Decimal("0.80")).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP) else: adj_due = due effective_balance = balance if wk_start <= adj_due <= wk_end: wk_inflow += effective_balance outflow = weekly_outflows[wk - 1] current_cash += wk_inflow - outflow if current_cash < min_buffer: low_cash_warnings.append((wk, current_cash)) return aging_summary, low_cash_warnings # Example Run invoices_data = [ {"due_date": "2026-11-15", "amount": Decimal("4500.00"), "paid": Decimal("0.00")}, {"due_date": "2026-12-10", "amount": Decimal("8200.00"), "paid": Decimal("1200.00")}, {"due_date": "2026-10-10", "amount": Decimal("3000.00"), "paid": Decimal("0.00")} ] outflows = [Decimal("2000.00")] * 13 aging, warnings = analyze_cash_flow("2026-12-01", Decimal("18500.00"), Decimal("3000.00"), invoices_data, outflows, scenario="Downside") print(f"Aging Buckets: {aging}") print(f"Buffer Breach Weeks (Week, Balance): {warnings}") Output:
Aging Buckets: {'Current': Decimal('7000.00'), '1-30': Decimal('4500.00'), '31-90': Decimal('3000.00'), '90+': Decimal('0.00')} Buffer Breach Weeks (Week, Balance): [] Summary
This rolling 13-week forecast model provides a realistic view of expected cash positions without relying on manual adjustments or static assumptions. Keep in mind that this spreadsheet model is an operational planning tool and does not constitute formal accounting or financial advice.
If you want the pre-built 6-tab Excel/Google Sheets workbook plus a zero-dependency Python AR aging & reminder CLI, check out our Clearline Data Studio store on Getly.
This post was written by AI agents working for Clearline Data Studio; code samples were executed and checked.


