How to Build a P&L by Location in Excel From Your Accounting Export
Build a monthly P&L for each shop or site from the accounting export with SUMIFS, split head office costs with a stated key and catch untagged costs.
- Excel
- Finance
- Reporting Workflows

On this page
- What does a P&L by location look like?
- How do you prepare the accounting export?
- How do you sum each line by location and month?
- How do you split head office costs between locations?
- How do you compare locations month over month?
- What makes location profits wrong?
- Where does Glow Reports fit?
- Common questions
A P&L by location shows revenue, costs and profit for each shop, site or brand, month by month. Your accounting export already holds every line. What it lacks is the layout: accounts grouped into P&L lines, each row tagged with its site, and a fair share of head office costs. In Excel, that takes a mapping table, one SUMIFS per cell and an allocation key you write down. Below: the steps on a sample export from three shops, the formulas, two allocation keys and how they change the answer, and the traps that make site profits add up to more than the business earned.
What does a P&L by location look like?
One column per location, one row per P&L line, and a total column that matches the company P&L. Revenue sits at the top, then cost of goods sold, gross profit, the site's own costs, the site contribution, a share of shared costs and operating profit at the bottom.
The example is a retailer with three shops, in Lyon, Nantes and Lille, plus a head office. The month is October 2026, in euros. Costs show as negative numbers, so each subtotal is a plain sum.
| Line | Lyon | Nantes | Lille | Total |
|---|---|---|---|---|
| Revenue | 84,000 | 61,500 | 47,200 | 192,700 |
| Cost of goods sold | -37,800 | -28,300 | -22,600 | -88,700 |
| Gross profit | 46,200 | 33,200 | 24,600 | 104,000 |
| Staff | -18,400 | -14,900 | -12,800 | -46,100 |
| Rent | -6,500 | -4,800 | -4,200 | -15,500 |
| Site contribution | 21,300 | 13,500 | 7,600 | 42,400 |
| Shared costs (revenue key) | -9,808 | -7,181 | -5,511 | -22,500 |
| Operating profit | 11,492 | 6,319 | 2,089 | 19,900 |
| Operating margin | 13.7% | 10.3% | 4.4% | 10.3% |
Site contribution is what a site earns before any head office cost. It answers "would we earn less if this shop closed?" Operating profit after the allocation answers a different question: "does this shop carry its share of the overhead?" Show both lines. Readers who only see the last one tend to close the wrong shop.
How do you prepare the accounting export?
Export the general ledger for the month with one row per entry, then add two columns: the P&L line and a signed amount.
The site tag has to be in the export already. QuickBooks Online calls it a location: "Location tracking is used to categorize data from different locations, offices, regions, outlets, or departments of the same company", on the Plus and Advanced plans only QuickBooks Help. You turn on the Track locations switch in the Categories section of SettingsAccount and settingsAdvanced, then add each shop under SettingsAll listsLocations.
Xero does the same job with tracking categories. Under AccountingAccounting settingsTracking categories, add a category named Location with one option per shop. Xero allows four tracking categories, and only two can be active at the same time Xero Central. Either way, the tag lands in a column of the export.
Here are five rows of the sample ledger, loaded as an Excel table named Ledger. The real export has one row per invoice or bill, but the shape is the same.
| Date | Account | Account name | Location | Amount |
|---|---|---|---|---|
| 2026-10-31 | 4000 | Sales | Lyon | -84,000 |
| 2026-10-31 | 5000 | Cost of goods sold | Lyon | 37,800 |
| 2026-10-31 | 6000 | Wages | Nantes | 14,900 |
| 2026-10-31 | 6100 | Rent | Lille | 4,200 |
| 2026-10-31 | 6200 | Marketing | Head office | 9,000 |
Look at the sign. Accounting exports often show revenue as a credit, so it comes out negative and costs come out positive. Flip it once, in a helper column, and never inside the report formulas.
Next, build a small mapping table on its own sheet, named Mapping, with two columns: Account and Line. Account 4000 maps to Revenue, 5000 to Cost of goods sold, 6000 to Staff, 6100 to Rent and 6200 to Marketing. Head office rows keep their own location, Head office, and become the shared costs later. Then add two columns to the Ledger table, Line and Signed:
=XLOOKUP([@Account],Mapping[Account],Mapping[Line],"Unmapped")=-[@Amount]XLOOKUP finds "things in a table or range by row", and when no match is found it returns the text you supply Microsoft Support. Filter the Line column on "Unmapped" each month. A new account opened by your accountant shows up there instead of vanishing from the report. Keep balance sheet accounts out of the mapping, since a P&L only reads revenue and expense accounts.
How do you sum each line by location and month?
Use SUMIFS with a condition on the line, the location and the date. SUMIFS "adds all of its arguments that meet multiple criteria" Microsoft Support, so one formula copied across the grid fills the whole table.
Put the first day of the month in B1, the location names in B4:D4 and the P&L lines in A5:A8. Then type this in B5 and copy it across and down:
=SUMIFS(Ledger[Signed],Ledger[Line],$A5,Ledger[Location],B$4,Ledger[Date],">="&$B$1,Ledger[Date],"<="&EOMONTH($B$1,0))EOMONTH "returns the serial number for the last day of the month that is the indicated number of months before or after start_date" Microsoft Support. With 0 months, it gives the last day of the month in B1, so changing B1 to 1 November rebuilds the whole P&L. The dollar signs lock the line to column A and the location to row 4. For more on date ranges in SUMIFS, see how to use SUMIFS with multiple criteria.
Because costs are negative, gross profit is revenue plus cost of goods sold, and site contribution is gross profit plus staff plus rent. No subtraction to get wrong.
A pivot table gives the same grid with less typing. Select the Ledger table, go to InsertPivotTable, then drag Line to Rows, Location to Columns and Signed to Values Microsoft Support. Group the dates by month as shown in how to create a pivot table by month. The pivot sorts lines alphabetically and has no gross profit row, so the SUMIFS layout is easier to keep in a fixed P&L format. In Google Sheets, SUMIFS takes the same arguments Google Docs Editors Help.
How do you split head office costs between locations?
Pick one allocation key, apply it to every shared cost, and print the key under the table. The two common keys are each site's share of revenue and each site's share of headcount. Both always add back to the full 22,500 of shared costs.
First total the head office rows for the month in B14. The result is -22,500, negative like every cost:
=SUMIFS(Ledger[Signed],Ledger[Location],"Head office",Ledger[Date],">="&$B$1,Ledger[Date],"<="&EOMONTH($B$1,0))With total revenue in E5, the Lyon share by revenue is:
=$B$14*B5/$E$5Lyon makes 43.6% of revenue, so it takes 43.6% of the overhead. By headcount, with 9 staff in Lyon, 7 in Nantes and 6 in Lille, Lyon takes 9 out of 22 instead. Here is what each key does to operating profit, for October and September:
| Month and key | Lyon | Nantes | Lille |
|---|---|---|---|
| Headcount | 9 | 7 | 6 |
| October, revenue key | 11,492 | 6,319 | 2,089 |
| October, headcount key | 12,095 | 6,341 | 1,464 |
| September, revenue key | 9,515 | 7,028 | 656 |
| September, headcount key | 9,882 | 7,464 | -145 |
| September revenue | 79,600 | 63,200 | 44,100 |
-145 euros of operating profit for Lille in September with the headcount key. The revenue key shows a profit of 656 for the same month.
Neither key is right in every case. Revenue suits costs that grow with sales, such as marketing. Headcount suits costs that grow with people, such as payroll and HR software. Some teams split each shared cost by its own key. What matters is to choose the key before you see the result, keep it from month to month, and say which one you used. A shop that turns from a profit into a loss because someone changed the key is a finding about the spreadsheet, not about the shop.
How do you compare locations month over month?
Compare the site contribution first. It depends only on the site's own revenue and costs, while the allocated profit moves when another site grows. Lille's operating profit with the revenue key went from 656 to 2,089, a rise of 218%. That figure says more about the tiny September base than about the shop.
The site contributions tell a steadier story:
- Lyon went from 18,800 to 21,300, up 13.3%.
- Nantes went from 14,400 to 13,500, down 6.25%.
- Lille went from 5,800 to 7,600, up 31.0%.
Each change is on the two months, as explained in how to calculate percentage change in Excel. Divide each contribution by the site's revenue to get a margin you can compare across shops of different sizes: 25.4% for Lyon, 22.0% for Nantes and 16.1% for Lille in October. The margin formulas are in how to calculate profit margin in Excel.
What makes location profits wrong?
Most errors come from rows that fall outside the grid or land in the wrong cell. The total column catches the first kind, so build it before anything else.
- Untagged costs. If the head office rows have no location, a SUMIFS by location skips them. The three shops then show 42,400 of profit, while the business earned 19,900. Add a check cell that compares the total operating profit with , on a ledger that holds the one month. Any gap is a row the grid missed.
- Transfers between sites. If Lyon sends 3,000 of stock to Lille and books it as a sale, Lyon's profit rises by 3,000 and Lille's falls by 3,000. The total does not move, so the check cell misses it. Book transfers on their own account, at cost, and keep that account out of revenue.
- The sign. Flip it once in the Signed column. A report where some formulas flip and others don't ends up with revenue counted as a cost.
- Late closing. A site that books October rent in November shows two rents in one month and none in the other. Wait until every site has closed the month, or ask your accountant for an accrual.
If each site keeps its own export, combine them first. How to merge Excel and CSV files with Power Query covers that step.
Where does Glow Reports fit?
The workbook above works, and it is worth building once to understand your numbers. The monthly rebuild is the costly part: a fresh export, new accounts to map, the allocation to redo, the check cell to reconcile and the text to write for the board.
Glow Reports starts from the export itself. You upload the CSV or Excel file and ask, in plain language, for a P&L by location for October with head office costs split by revenue share. The AI writes the SQL, builds the charts and drafts the text. The SQL sits under each figure, so you can see which accounts went into each line and which key split the shared costs, and edit the query if needed. Reports export to PDF and stay in the workspace. The free plan gives 300 credits once, and a report costs 100 credits.
Common questions
Can I build a P&L by brand or region the same way?
Yes. Replace the Location column with the tag that holds the brand. For regions, add a second small table that maps each site to its region, look the region up in the Ledger with XLOOKUP, and point the SUMIFS at that column instead.
Should I allocate head office costs at all?
Show the site contribution in every case, and add an allocated profit only if someone decides with it, such as a bonus or a lease renewal. An allocation adds a choice to every figure, so it needs a stated key.
Why doesn't my P&L by location match the company P&L?
Usually because of rows with no location, accounts missing from the mapping table, or entries dated outside the month. The check cell against shows the gap, and filters on blank locations and on "Unmapped" show where it comes from.
What is a good margin for a single location?
It depends on the trade and on how much of the overhead you allocate. Compare each site with its own past months and with the other sites under the same key, rather than with a figure from another business.
I am a product engineer and the founder of Glow Reports. I spent more than 6 years building products in tech, data and cybersecurity, for large groups, startups and SMEs. In most organizations I saw data treated as a technical topic, when it drives business decisions. I built the reporting tool I was looking for, so the people who run small and mid-sized organizations can read their own numbers without a data team.
More from El Mehdi BenaneUpload your accounting export to Glow Reports and get a P&L by location for the month, with the SQL behind each figure.
Keep reading
Budget vs Actual in Excel: Variance Formulas, Year to Date and What to ExplainEl Mehdi Benane, 4 min read
Ad Hoc Reporting Requests: How to Cut the Queue So Business Teams Answer Their Own QuestionsEl Mehdi Benane, 4 min read
How to Calculate Days Between Two Dates in Excel, and Fix DATEDIF #NUM!El Mehdi Benane, 4 min read