Automate Google Sheets: the weekly report that builds itself
Three regions send their sales figures, someone copies them together, checks targets by eye and chases missing stores. Every week. This guide shows how to build that report once with smart formulas, a recorded macro and AI as your formula helper. No Apps Script, no add-ons.
- VSTACK + FILTER combine several tabs into one master table, and new rows flow in on their own.
- XLOOKUP, BYROW and QUERY add targets and build a summary that follows a drop-down.
- LET + MAP compare this week with last week and flag missing or unusual figures.
- A recorded macro handles the formatting, AI writes and explains new formulas for you.
The use case: one weekly sales report, three regions
A field sales team has nine stores in three regions. Each region keeps its own tab. Head office keeps the store list with weekly targets. The aim: a report that shows revenue against target, names the stores that did not report and flags anything that moved more than 15 %.
Before: by hand
- Copy three tabs into one, week after week
- Fix typos and stray spaces in store names
- Look up each target and work out the %
- Spot missing stores by scrolling
After: built once
- New rows appear in the master table on their own
- Names are cleaned while they are stacked
- Choose a week in a drop-down, the summary follows
- Missing and unusual stores are flagged, an email can follow
Practice data to copy
Open a blank spreadsheet and create four tabs: North, South, West and Targets. Click “Copy data”, click cell A1 of the matching tab and press Ctrl+V. Then add three empty tabs: Master, Report and Check.
The data contains two mistakes on purpose: “munich ” with a trailing space and “ Frankfurt” with a leading space. Bremen has no figures for week 49.
| Week | Region | Store | Units | Revenue |
|---|---|---|---|---|
| 48 | North | Hamburg | 412 | 8240 |
| 48 | North | Kiel | 198 | 3960 |
| 48 | North | Bremen | 265 | 5300 |
| 49 | North | Hamburg | 436 | 8720 |
| 49 | North | Kiel | 151 | 3020 |
| Week | Region | Store | Units | Revenue |
|---|---|---|---|---|
| 48 | South | Munich | 388 | 7760 |
| 48 | South | Stuttgart | 240 | 4800 |
| 48 | South | Nuremberg | 205 | 4100 |
| 49 | South | munich | 401 | 8020 |
| 49 | South | Stuttgart | 262 | 5240 |
| 49 | South | Nuremberg | 199 | 3980 |
| Week | Region | Store | Units | Revenue |
|---|---|---|---|---|
| 48 | West | Cologne | 301 | 6020 |
| 48 | West | Bonn | 276 | 5520 |
| 48 | West | Frankfurt | 350 | 7000 |
| 49 | West | Cologne | 330 | 6600 |
| 49 | West | Bonn | 280 | 5600 |
| 49 | West | Frankfurt | 268 | 5360 |
| Store | Region | Weekly target |
|---|---|---|
| Hamburg | North | 8000 |
| Kiel | North | 4000 |
| Bremen | North | 5000 |
| Munich | South | 7500 |
| Stuttgart | South | 5000 |
| Nuremberg | South | 4000 |
| Cologne | West | 6500 |
| Bonn | West | 5500 |
| Frankfurt | West | 7200 |
Consolidate all regions into one master table
In tab Master, type the headers in row 1: Week, Region, Store, Units, Revenue, Target, vs target. Then one formula in A2 does the rest. It has three parts:
Puts the three tabs on top of each other: North, South, West.
Open ranges like A2:E include every future row.
Keeps only rows with a week in column 1.
Open ranges also bring hundreds of empty rows.
Removes spaces and fixes capitals in the store column.
“munich ” becomes “Munich”.
- Start simple. Click Master!A2 and enter
=VSTACK(North!A2:E,South!A2:E,West!A2:E)All rows appear, followed by a long tail of empty rows. That tail is why step 2 exists. - Replace it with the full formula below. LET gives each part a name, so you can read it like a recipe: all, then rows, then the cleaned result.
- Press Enter. Master now shows 17 rows, with “Munich” and “Frankfurt” spelled cleanly.
- Test the automation: add the row
49 | North | Bremen | 240 | 4800at the bottom of tab North. It appears in Master instantly. Delete it again for the next steps.
=LET(all,VSTACK(North!A2:E,South!A2:E,West!A2:E),rows,FILTER(all,CHOOSECOLS(all,1)<>""),HSTACK(CHOOSECOLS(rows,1,2),ARRAYFORMULA(PROPER(TRIM(CHOOSECOLS(rows,3)))),CHOOSECOLS(rows,4,5)))=VSTACK(IMPORTRANGE("URL of file North","Sheet1!A2:E"),IMPORTRANGE("URL of file South","Sheet1!A2:E"))Cross-reference: add the target to every row
The master table knows the revenue, the Targets tab knows the target. XLOOKUP connects them, and ARRAYFORMULA lets one formula fill the whole column, including rows that arrive next week.
- Click Master!F2 and enter the target formula. Each store gets its weekly target. A store missing from the list shows “No target”.
- Click Master!G2 and enter the % formula. Then format column G as a percentage: Format › Number › Percent.
- Check the result: Kiel and Frankfurt sit around 75 % in week 49, everyone else close to or above 100 %.
=ARRAYFORMULA(IF(C2:C="","",XLOOKUP(C2:C,Targets!A2:A,Targets!C2:C,"No target")))=ARRAYFORMULA(IF(C2:C="","",E2:E/F2:F))Why IF(C2:C="","",…)? It keeps the formula quiet in empty rows, so the column does not fill up with errors.
The dynamic report: pick a week, everything updates
In tab Report, B1 holds the week. Everything else reads from it.
- Build the drop-down: type “Week” in A1, click B1, choose Insert › Dropdown and add the options 48 and 49. Select 49.
- Total and % vs target: type “Total revenue” in D1 and “vs target” in D2, then enter the two formulas in E1 and E2.E2 divides by the full target list on purpose. If a store does not report, the gap shows up instead of hiding.
- Summary by region: click A3 and enter the QUERY formula. It writes a small table: region and revenue for the selected week.The &B1& part glues the drop-down value into the query, so the table follows your choice.
- Target per region: type “Target” in C3 and “vs target” in D3. In C4, BYROW runs a small LAMBDA once per region and sums its targets. D4 divides revenue by target.
- Stores below target: type “Below target this week” in G1 and enter the last formula in G2. IFNA shows a friendly message when no store is below target.
- Test it: switch B1 to 48 and back to 49. Every number moves with it.
=SUMIFS(Master!E2:E,Master!A2:A,B1)=E1/SUM(Targets!C2:C)=QUERY(Master!A1:E,"select B, sum(E) where A = "&B1&" group by B label sum(E) 'Revenue'",1)=BYROW(A4:A8,LAMBDA(region,IF(region="","",SUMIFS(Targets!C2:C,Targets!B2:B,region))))=ARRAYFORMULA(IF(A4:A8="","",B4:B8/C4:C8))=IFNA(SORT(FILTER({Master!C2:C,Master!G2:G},Master!A2:A=B1,Master!G2:G<1),2,TRUE),"All stores on target")Your result for week 49:
| Region | Revenue | Target | vs target |
|---|---|---|---|
| North | €11,740 | €17,000 | 69% |
| South | €17,240 | €16,500 | 104% |
| West | €17,560 | €19,200 | 91% |
Total revenue: €46,540, 88 % of target. North looks weak because Bremen has not reported yet. Step 4 makes that visible.
Compare datasets: flag missing stores and big changes
Tab Check compares two sources: the store list from head office and the reports that actually came in. It also sets this week against last week.
- Link the week: type “Week” in A1 and
=Report!B1in B1. Check now follows the same drop-down. - Who did not report? Type “No report this week” in A2 and enter the first formula in A3. COUNTIFS counts each store’s rows for the week. Zero rows means missing. Result: Bremen.
- This week against last week: type the headers Store, Last week, This week, Change, Status in A6:E6. Enter the comparison formula in A7.LET names each column, MAP calculates it store by store, HSTACK puts the five columns side by side. Status says Missing, New, Check (±15 % or more) or OK.
- Colour the flags: select A7:E30, choose Format › Conditional formatting › Custom formula is, enter
=$E7="Missing"with a red fill. Add a second rule with=$E7="Check"in yellow. - One alert cell: type “Alert” in D1 and enter the alert formula in E1. Week 49 reads “1 missing, 2 to check”.
=IFNA(FILTER(Targets!A2:A,Targets!A2:A<>"",COUNTIFS(Master!C2:C,Targets!A2:A,Master!A2:A,B1)=0),"All stores reported")=LET(stores,FILTER(Targets!A2:A,Targets!A2:A<>""),wk,B1,last,MAP(stores,LAMBDA(s,SUMIFS(Master!E2:E,Master!C2:C,s,Master!A2:A,wk-1))),now,MAP(stores,LAMBDA(s,SUMIFS(Master!E2:E,Master!C2:C,s,Master!A2:A,wk))),change,MAP(last,now,LAMBDA(l,n,IF(OR(l=0,n=0),"",n/l-1))),status,MAP(last,now,LAMBDA(l,n,IFS(n=0,"Missing",l=0,"New",ABS(n/l-1)>=0.15,"Check",TRUE,"OK"))),HSTACK(stores,last,now,change,status))=IF(COUNTIF(E7:E,"Missing")+COUNTIF(E7:E,"Check")=0,"All good",COUNTIF(E7:E,"Missing")&" missing, "&COUNTIF(E7:E,"Check")&" to check")Your result for week 49:
| Store | Last week | This week | Change | Status |
|---|---|---|---|---|
| Hamburg | €8,240 | €8,720 | +6% | OK |
| Kiel | €3,960 | €3,020 | -24% | Check |
| Bremen | €5,300 | €0 | Missing | |
| Munich | €7,760 | €8,020 | +3% | OK |
| Stuttgart | €4,800 | €5,240 | +9% | OK |
| Nuremberg | €4,100 | €3,980 | -3% | OK |
| Cologne | €6,020 | €6,600 | +10% | OK |
| Bonn | €5,520 | €5,600 | +1% | OK |
| Frankfurt | €7,000 | €5,360 | -23% | Check |
Munich only matches because step 1 cleaned “munich ”. Without TRIM, Munich would show up as missing. Week 48 shows “New” for every store, because there is no week 47 in the data.
Automatic notifications, without code
- Any change: Tools › Notification settings › Edit notifications. Choose “Any changes are made” and “Email – right away” or a daily digest.
- Rule-based: Tools › Conditional notifications › Add rule, for example “column Status changes to Missing”, plus the email addresses to inform. Google offers this for certain work and school accounts. If you do not see the menu item, ask your admin.
Record a macro and let AI write the next formula
A macro for the recurring clean-up
Formulas calculate. A macro repeats clicks: formatting, sorting, freezing the header. You record it once, no coding.
- Start recording: Extensions › Macros › Record macro. Choose Use absolute references if the macro should always work on the same cells, or Use relative references if it should start wherever your cursor is.
- Do the clicks once: for example in tab Master, make row 1 bold, freeze it (View › Freeze › 1 row), format E:F as currency and G as percent.
- Save: give it a name like “Format master” and a shortcut number. From then on Ctrl+Alt+Shift+1 runs it (Mac: ⌘+Option+Shift+1).
- First run: Google asks once for permission. That is normal, because the recording is stored as a small script in the background.
AI as your formula helper
ChatGPT or Claude write formulas like the ones above in seconds, if you describe your sheet precisely. This template works well. Fill in the brackets:
You are a Google Sheets expert. Write ONE formula for Google Sheets (no Apps Script). My data: tab [Master], headers in row 1: [Week | Region | Store | Units | Revenue | Target | vs target], data from row 2, new rows are added every week. Goal: [Show every store whose revenue this week is more than 15 % below last week.] The week is in cell [Report!B1]. The result goes into cell [Check!A3]. My spreadsheet uses [commas] as separators. Please: 1) give the formula, 2) explain each part in one line, 3) name one case where it would break.- Test before you trust: paste the formula into a copy of the sheet and check two rows by hand.
- Ask for the weak spot: “When would this formula break?” often reveals blank rows or spaces.
- Iterate: “Rewrite it with LET so it is easier to read” or “Make it work for open ranges”.
Two extras for advanced users
Your own function with a name
Data › Named functions › Add new function. Name it ATTAINMENT, add the placeholders actual and target and use the definition below without the LAMBDA wrapper: IFERROR(actual/target,""). Then anyone in the file can write =ATTAINMENT(E2,F2). Try the logic first as a LAMBDA:
=LAMBDA(actual,target,IFERROR(actual/target,""))(E2,F2)QUERY instead of FILTER
Prefer one readable line? QUERY can also stack and filter in one go. Col1 stands for the first column of the stacked data.
=QUERY(VSTACK(North!A2:E,South!A2:E,West!A2:E),"select * where Col1 is not null",0)If it does not work
- #REF! “Array result was not expanded” – something is in the way of the result. Clear the cells below or right of the formula.
- #N/A from FILTER – nothing matches. Wrap the formula in IFNA with a friendly message, as in steps 3 and 4.
- A store shows as missing although it reported – a space or typo in its name. TRIM and PROPER in step 1 fix that at the source.
- Formula parse error – your locale expects semicolons. Check File › Settings › Locale, or replace each comma with a semicolon.
Your turn: automate one report this week
Pick the report you build by hand most often and go through this checklist:
- Where does the data come from, and is each source in one tab or file with the same columns?
- Which formula stacks it: VSTACK for tabs, IMPORTRANGE for files?
- Which value do you look up from a second list, such as targets or prices?
- Which cell should control the report: week, region or product?
- What counts as “unusual”, and who needs an email when it happens?
- Which clicks do you repeat every time? Record them as a macro.
Automate the reports your team builds by hand
This exercise comes from our Google Sheets automation training. Your team works on its own reports, from consolidation to alerts, in the advanced Google Sheets training, on site or live online. For a kick-off or team event, book a talk on smarter work with data and AI.
More Google Sheets guides: XLOOKUP in Google Sheets, chart data range · Trainings: Google Sheets training, Google Sheets dashboard training
Automate Google Sheets: frequently asked questions
Can I automate Google Sheets without Apps Script?
How do I combine data from several spreadsheets?
Can Google Sheets send me an email when something changes?
Comma or semicolon in formulas?
Are recorded macros shared with my colleagues?
Google Sheets is a trademark of Google LLC. ChatGPT is a trademark of OpenAI; Claude is a trademark of Anthropic. SkillDay is an independent training provider. The practice data is fictitious.