# Gridline · Spreadsheet — Product Requirements (v1.1)

Gridline is a browser spreadsheet. It opens the "FY27 Marketing Budget" workbook with three sheets: Budget (ten line items by quarter with totals, plan, variance, variance %, a Status dropdown and a share column, plus a tax line), Rates (inputs) and a protected Summary built from cross-sheet formulas. The grid is drawn on a canvas, with a name box, formula bar, toolbar, keyboard navigation, drag-to-fill, sort, undo/redo, sheet tabs and a Sum / Average / Count status bar.

**Problem.** Finance and marketing users need a spreadsheet whose numbers they can trust: formulas must recalculate everywhere they are used, fill and sort must keep rows intact, and validation and protection must hold.

## Users
- **Budget owner** — Edit quarterly figures and see totals, variance and the Summary update at once.
- **Reviewer** — Read a protected Summary that cannot be changed by accident.

## Goals
- Every dependent cell, on any sheet, updates when an input changes.
- Fill copies relative references shifted and absolute ($) references unchanged.
- Sort moves whole rows with their formulas, notes and owners.
- Money is displayed rounded to the nearest cent.

## Workbook and calculation (CAL)

Seeded values, totals and recalculation.

- **FR-CAL-01** (Must) The workbook opens on the Budget tab, shows "Saved" and calculates its seeded values.
  - Header: Line item, Owner, Q1, Q2, Q3, Q4, Total, Plan, Variance, Var %, Status, Share
  - Row 2 Paid search / Minh Ho: 12,500.00; 13,200.00; 14,100.00; 15,800.00; Total 55,600.00; Plan 54,000.00; Variance 1,600.00; Var % 3.0%; Approved; Share 23.3%
  - G2 holds =SUM(C2:F2)
  - Total row 13: Q1 41,683.83, Q2 66,783.83, Q3 50,333.83, Q4 79,483.84, Total 238,285.33, Plan 212,300.00, Variance 25,985.33, Var % 12.2%
  - Sales tax $17,871.40; Total incl. tax $256,156.73
- **FR-CAL-02** (Must) Editing an input recalculates its row, the totals and every dependent cell on other sheets; undo restores the previous values.
  - C2 = 22500: G2 65,600.00, I2 11,600.00, J2 21.5%, G13 248,285.33, G16 $266,906.73
  - Summary: Spend $248,285.33, Total incl. tax $266,906.73, Approved spend $133,685.33; VND 6,779,431,000
  - Ctrl+Z returns C2 to 12,500.00 and G13 to 238,285.33
- **FR-CAL-03** (Should) A rate on the Rates sheet feeds Budget and Summary.
  - Rates: Sales tax 7.5%, USD to VND 25,400, Contingency 5.0%
  - Sales tax 8%: G15 $19,062.83, G16 $257,348.16; Summary B6 $19,062.83, B12 $12,867.41
- **FR-CAL-04** (Must) AVERAGE ignores blank cells (they are neither counted nor treated as zero), consistently in formulas and in the status bar.
  - C14 =AVERAGE(C2:C11) shows 4,631.54 (41,683.83 over 9 non-blank cells)
  - Selecting C2:C11: Average 4,631.54, Count 9
- **FR-CAL-05** (Must) Currency values are shown rounded to the nearest cent, never truncated.
  - Sales tax of 17,871.39975 shows $17,871.40 on Budget and on Summary
- **FR-CAL-06** (Should) The status bar summarises the selection with Sum, Average and Count.
  - C2:C4: Sum 27,100.00, Average 9,033.33, Count 3
  - D2:D4: Sum 28,200.00
  - L2:L11: Sum 100.0%, Count 10

## Editing and formulas (EDT)

In-cell editor, point mode and errors.

- **FR-EDT-01** (Should) While typing a formula, clicking a cell inserts its reference, outlines it and colours the matching text; Esc cancels.
  - "=" then click G2 gives "=G2"; "*" then click H2 gives "=G2*H2" with differently coloured outlines
  - Esc leaves the cell empty and removes the outlines
  - =G2/H2 shows 1.02962963 in general format and 103.0% after the % button
- **FR-EDT-02** (Should) A syntactically invalid formula is rejected and never stored; unknown functions and circular references give specific error values with tooltips.
  - =SUM(C2:F2 shows "There's a problem with this formula: Expected )" and the editor stays open
  - =SUMM(C2:F2) shows #NAME? with tooltip "Unknown function or name"
  - =M3+1 in M3 shows #CIRC! with tooltip "Circular reference"
  - Delete clears the cells and the red triangles
- **FR-EDT-03** (Could) Keyboard navigation and shortcuts work, and the reset button restores the seeded workbook after confirmation.
  - A2 then Tab x3 gives D2; Shift+Down x2 selects D2:D4
  - Ctrl+B makes bold, Ctrl+Z undoes; F2 opens the editor with the caret after "13200"
  - After reset, G13 is 238,285.33

## Fill (FIL)

Drag-to-fill with anchored references.

- **FR-FIL-01** (Must) Dragging the fill handle copies the formula down, shifting relative references and keeping $-anchored ones.
  - L6 is =G6/$G$13; filling to L11 gives L7 =G7/$G$13
  - L7 2.1%, L8 3.9%, L9 7.4%, L10 7.2%, L11 1.9%; L2:L11 sums to 100.0%
  - A dashed outline covers the fill range while dragging

## Sort (SRT)

Row sort by the active column.

- **FR-SRT-01** (Must) Sorting by a column moves entire rows (all columns, formulas and notes) within the line items; the header and Total row stay put and totals are unchanged.
  - Sort Z to A by Total: Paid search, Events, Social ads, Content production, Sponsorships, Video, PR agency, Email platform, SEO tooling, Research panels
  - Row 3: Events, Quang Do, blank Q1, 18,000.00, 4,500.00, 22,400.00, 44,900.00, 40,500.00, On hold; G3 =SUM(C3:F3); G13 stays 238,285.33
  - The Plan-cut note moves with its row
- **FR-SRT-02** (Must) Sorting by Line item A to Z keeps owners and numbers with their line item.
  - Order: Content production, Email platform, Events, Paid search, PR agency, Research panels, SEO tooling, Social ads, Sponsorships, Video
  - Row 2: Content production, Linh Pham, Total 27,550.00; row 3: Email platform, Thao Vu, 9,333.33

## Sheets, validation and protection (SHT)

Tabs, rename, status list and the protected Summary.

- **FR-SHT-01** (Must) Cells that refer to other sheets recalculate after an edit.
  - After C2 = 22500, Summary B3 reads $248,285.33
- **FR-SHT-02** (Should) Renaming a sheet validates the name and rewrites references on other sheets, quoting names that need it.
  - "Q1/Q2": "Sheet names are 1–31 characters and cannot contain [ ] : * ? / \ or '"
  - "rates": "A sheet named rates already exists"
  - "Budget FY27" accepted; Summary B3 ='Budget FY27'!G13 still $238,285.33; B10 =SUMIF('Budget FY27'!K2:K11,"Approved",'Budget FY27'!G2:G11) = $123,685.33
- **FR-SHT-03** (Should) The Status column accepts only Open, Approved, On hold or Rejected, normalises case, and changes feed the Summary.
  - Chevron list shows the four values with the current one ticked
  - K4 to Approved: Summary B10 $151,235.33
  - "Pending": "K5 only accepts: Open, Approved, On hold, Rejected"; "rejected" is stored as "Rejected"
- **FR-SHT-04** (Should) The Summary sheet is protected: its formulas are visible but typing, deleting and renaming are refused.
  - Orange tab with a lock icon; B9 =COUNTIF(Budget!I2:I11,">0") shows 6
  - Toast "Summary is protected — its cells are read-only" for typing, Delete and rename
  - B8 tooltip "Rounded to the nearest 1,000 ₫."

## Markers and toolbar (MRK)

Small canvas cues and icon buttons.

- **FR-MRK-01** (Could) Notes, error flags, dropdown chevrons and negative variances are visible and explain themselves on hover.
  - H5 orange note "Plan cut by 10% after the September review."
  - C5 empty with note "No Q1 spend — the spring expo was cancelled."
  - J6 #DIV/0! with a red corner triangle, tooltip "Divide by zero"
  - Chevrons on K2:K11; negative Variance (I3 -1,450.00, I8 -266.67, I10 -800.00, I11 -750.00) in red; Share filled only for rows 2-6
- **FR-MRK-02** (Could) Icon-only toolbar buttons and the protected tab name themselves in tooltips.
  - "Undo (Ctrl+Z)", "Redo (Ctrl+Y)", "Bold (Ctrl+B)", "Italic (Ctrl+I)"
  - "Format as currency", "Format as percent", "Number, 2 decimals", "Plain number", "Fill colour" (six swatches)
  - "Sort rows A → Z by the active column", "Sort rows Z → A by the active column", "Reset demo workbook", "Protected sheet"

## Glossary and rules

- **Absolute reference** — A reference with $ (for example $G$13) that does not shift when copied or filled.
- **Point mode** — Clicking cells while typing a formula to insert their references.

## Out of scope

- Import and export
- Charts
- Multi-user collaboration
