Skip to content
PracticeGuru LearningsBlog for tax and accounts offices

Office skills

Power Query and Macros for Accountants: Automate Excel

By PracticeGuru Learnings team · Published 20 Oct 2026 · 10 min read

For CAs, CSs, CMAs, tax consultants, advocates' offices and their office staff.

Banner: Power Query and macros for accountants, automate monthly Excel jobs
In this article
  1. Which jobs to automate: the monthly-repeat test
  2. Which Excel you need
  3. Power Query for accountants: your first query in 10 steps
  4. Your first macro: record it, then make it safe
  5. Macro safety rules for the office
  6. Make it last: queries that survive next month
  7. Questions people ask
  8. Sources
Key points
  • Power Query cleans, combines and reshapes data, then repeats every step with one Refresh. It never changes the original file.
  • Macros repeat actions on a workbook, such as formatting, splitting and saving as PDF, with one button.
  • Use the monthly-repeat test: comes back every month, same layout, over 15 minutes, fixed rules. Four yeses, automate it.
  • Microsoft Office on Windows blocks macros in files from the internet by default. Keep one trusted folder and review any code before use.
  • Build on Windows desktop Excel; Excel for the web and phones cannot do all of this.

Power Query for accountants solves one specific problem: the Excel job you did last month, and will do again next month, step for step. Cleaning the same bank statement download, copying eight staff timesheets into one sheet, stacking four branch fee registers. This guide shows which jobs suit Power Query, which suit macros, how to build your first of each, and the safety rules that keep macros from becoming a risk in your office.

Both tools are already inside your Excel. Power Query cleans and joins data, then repeats the cleaning with one Refresh. Macros repeat actions on a workbook, such as formatting, splitting and saving, with one button.

Which jobs to automate: the monthly-repeat test

Before you automate anything, ask four questions about the job:

  1. Does it come back every month or every week?
  2. Does the data arrive in the same layout each time?
  3. Does it take more than 15 minutes by hand?
  4. Are the steps fixed rules, with no judgement?

Four yeses: automate it. A "no" to question 4 means a person must still decide, so automate only the boring part around the decision. A "no" to question 2 means fix the source first, for example by asking for the same export format every time.

Formula, Power Query or macro?

Think of the three tools as three different staff members.

  • A formula does one calculation next to the data, such as days since an invoice or a client name looked up from a code. It recalculates by itself, but it cannot clean or reshape a messy file.
  • Power Query is the person who tidies the data before anyone uses it: removes junk rows, fixes dates, joins two lists, stacks twelve files. It writes down every step and repeats them on demand. It never touches the original file, so a mistake costs you nothing.
  • A macro is the person who does things to the workbook itself: formats, splits, saves, protects. It is powerful, which is also why it needs rules. A macro can delete or overwrite data, and there is no undo.

A good rule of thumb: if the job is about getting clean data, use Power Query. If it is about doing something with the finished workbook, use a macro.

Monthly job by handBest tool
Clean the office bank statement downloadPower Query
Copy eight staff timesheet files into one sheetPower Query (From Folder)
Stack the fee register sheets of four branchesPower Query
Add client name and partner to each invoicePower Query (Merge)
Find clients with no invoice this yearPower Query (Merge, Left Anti)
Fix a fee report with months across the topPower Query (Unpivot)
Partner-wise billed, collected and outstanding by agePower Query (Group By)
Mark invoices older than 60 daysA formula
Format the monthly billing reportMacro
One file per client from the work listMacro

Seven of these ten are Power Query jobs. That is typical, which is why most offices should learn Power Query before macros. For the formula side, see Excel for Chartered Accountants: 15 Formulas You Need.

Which Excel you need

  • Windows desktop Excel, Microsoft 365: the full feature set. Build here.
  • Excel 2016, 2019 and 2021 for Windows: Power Query is on the Data tab, in the Get & Transform group. Most features are there; some screens may differ.
  • Mac: only Excel for Microsoft 365 has Power Query, with fewer data sources. The macros most offices use are written for Windows.
  • Excel for the web and phones: fine for viewing and some refreshing, but not for building folder queries or running VBA macros.
Tip Quick check: open the Data tab and look for Get Data in the Get & Transform group. If it is there, you can start today.
Course: Excel Automation for Tax & Accounts Offices: Power Query & MacrosBuild these step by step with practice files

Excel Automation for Tax & Accounts Offices is 13 short lessons with practice files: clean, combine, merge, unpivot and summarise with Power Query, then record, edit and safely use macros for everyday office jobs.

Power Query for accountants: your first query in 10 steps

Take the office bank statement download, the one that arrives each month with bank logos in the first rows, dates as text and blank lines in between. Use a copy, or practice data, the first time.

  1. Make one folder for the source file, for example Office Data\Bank, and name one owner for it.
  2. In a new workbook: Data, Get Data, From File, then From Text/CSV or From Workbook, and pick the file.
  3. Click Transform Data (not Load). The Power Query Editor opens.
  4. Home, Remove Rows, Remove Top Rows to drop the bank's header lines.
  5. Use First Row as Headers.
  6. Remove Rows, Remove Blank Rows.
  7. For the date column: right-click, Change Type, Using Locale, Date, English (India). This reads 05-04-2026 as 5 April, not 4 May.
  8. Set the amount columns to Decimal Number. Remove any column you do not need.
  9. Home, Close & Load. A clean table appears in a new sheet.
  10. Next month, save the new download with the same name in the same folder and click Data, Refresh All. Every step runs again.

Each step you click is recorded in the Applied Steps list on the right. You can click any step to see the data at that point, or delete a step you got wrong. The original file is never changed.

Three more queries every office uses

Once the first query works, the same editor handles most other monthly jobs. Power Query for accountants becomes really useful when these three are added:

  • Combine a folder of files: Data, Get Data, From File, From Folder, then Combine & Transform. Eight timesheets become one table; next month, drop in the new files and Refresh.
  • Merge two lists: Home, Merge Queries. A Left Outer join adds client name and partner to each invoice. A Left Anti join, with the client master first, lists clients with no invoice.
  • Unpivot: select the fixed columns (Client, Partner), then Transform, Unpivot Other Columns. A report with April to March across the top becomes a proper list you can pivot and filter.

A fourth, Group By (Home, Group By), turns the cleaned fee register into a summary: total billed, collected and outstanding per partner, or by age bucket. Load it to a sheet, add a chart, and the monthly partner report refreshes with the data. The same approach feeds a client MIS, described in MIS Report Format in Excel for Clients (Free Template).

In a real office On the 3rd of every month, Swati spent her whole afternoon on the same bank statement, the same timesheets and the same billing report. After two weeks of practice, the three jobs became three Refresh clicks. She now spends that afternoon checking the results instead of building them.

Your first macro: record it, then make it safe

A macro is a recorded set of actions. Use one when Excel has to do something to a workbook: format a report, split it into files, save sheets as PDF, protect all sheets.

  1. Show the Developer tab: File, Options, Customize Ribbon, tick Developer.
  2. Save the workbook as Excel Macro-Enabled Workbook (.xlsm). A normal .xlsx file cannot keep macros.
  3. Developer, Record Macro. Give it a clear name like FormatBillingReport, store it in This Workbook.
  4. Do the steps once: bold the header, set column widths, apply number format, freeze the top row.
  5. Developer, Stop Recording.
  6. Test it on a copy of next month's report.

Recorded macros often hard-code the exact rows you used, so they break when next month has more rows. Learning to read and make two or three small edits in the VBA editor fixes that. The Excel Automation course covers this edit step and then builds three office macros: one file per client code, save chosen sheets as PDF, and protect or unprotect all sheets.

Macro safety rules for the office

Macros can run any code on your computer. That is why Microsoft now blocks macros in files from the internet, such as email attachments, by default, and shows a security risk banner instead. Treat that banner as a feature, not a nuisance.

Checklist
  • Emailed .xlsm files from outside the office are not opened with macros enabled. If a file is verified, unblock that one file only (right-click, Properties, Unblock).
  • One trusted folder, and only one, for the office macro workbook. Control who can save files there.
  • Macros cannot be undone with Ctrl+Z. Always run on a copy, or save first.
  • Only named people may write or change office macros.
  • Code from AI or the internet is read and tested on practice data before anyone uses it on real files.

An AI tool can write or explain macro code well if you describe the workbook layout. Never paste real client data into the chat. Our AI Automation for CA Firms: 10 Jobs to Automate Now guide covers the wider office automation picture, beyond Excel.

Make it last: queries that survive next month

A query built in one afternoon can break in month three. The usual causes are simple: a column header changed in the source file, text appeared in a number column, or someone moved the folder. Three habits prevent most breaks.

  • Write down a check number when you build the query: the row count and the total of the amount column. After every Refresh, compare.
  • Do not hide errors with Remove Errors. Find out which rows failed and why.
  • Keep a handover sheet in each workbook: what each query or macro does, the source folder, the owner, and the monthly check.

If a job is a one-off or changes every time, it is not worth automating. Keep using formulas, taught in the Excel for Tax Practice course. If it comes back every month in the same shape, build it once.

The Excel Automation for Tax & Accounts Offices course gives you practice files for every lesson, numbered clicks with "what you should see", ready code to paste if the clicks go wrong, and exact check numbers. Start with the free first lesson on what Power Query and macros do, and list your own monthly jobs as you read.

Questions people ask

What is Power Query used for in accounting?

Cleaning and combining data that arrives in the same layout every month: bank statement downloads, staff timesheets, branch registers and software exports. You build the steps once, and next month you click Refresh.

Is Power Query better than macros?

They do different jobs. Power Query is best for cleaning, combining and reshaping data, and it never changes the source file. Macros are best for actions on a workbook, such as formatting, splitting into files or saving as PDF. Most offices need Power Query first.

Which Excel version has Power Query?

Excel for Windows from Excel 2016 onwards, including Microsoft 365, has it on the Data tab under Get & Transform. On a Mac, only Excel for Microsoft 365 has it. Build on Windows desktop Excel for the full feature set.

Are Excel macros safe?

Macros can run any code, which is why Office blocks macros in files from the internet by default. They are safe when they come from your own office, live in one trusted folder, are reviewed before use and are run on a copy first.

Do I need to know coding to use macros?

No. You can record a macro by doing the steps once while Excel watches. Small edits to the recorded code, such as fixing a hard-coded range, are easy to learn and make the macro reliable.

Sources

Course: Excel Automation for Tax & Accounts Offices: Power Query & MacrosTurn your monthly Excel jobs into one click

Try the free first lesson of Excel Automation for Tax & Accounts Offices and list your own monthly jobs. The Office plan includes every course for the whole office, including Excel for Tax Practice.

Share with your team: WhatsApp LinkedIn X
About this article. Written by the PracticeGuru Learnings team at PracticeGuru (Brainy Accountant Solutions Pvt Ltd). Learnings courses are our product and are mentioned where they fit. This is general information, not professional or legal advice.