Excel PivotTable Profit and Loss

Mynda Treacy

July 30, 2020

Creating an Excel PivotTable Profit and Loss statement is surprisingly easy. And because it’s a PivotTable you can team it with Slicers to make it interactive.

While you’re at it you might as well add some conditional formatting to make reading, what is usually a drab report, quick and easy.

excel pivottable profit and loss animation

Watch the Video

Subscribe YouTube

Download Template Workbook

Enter your email address below to download the sample workbook.

By submitting your email address you agree that we can email you our Excel newsletter.

Excel PivotTable Profit and Loss Step by Step Instructions

My data (shown below) is in a tabular layout with each account classified into an ‘Account Group’. These account groups represent the different sections of a Profit and Loss statement.

excel pivottable profit and loss data

Step 1: Insert a PivotTable

Select the data > Insert tab > PivotTable. In the dialog box choose whether you want it in a new sheet or existing sheet.

insert excel pivottable

Step 2: Build the PivotTable

Add the Account Group and Account fields to the Rows and add Actual and Budget to the Values:

build an excel pivottable

Step 3: Rearrange the Account Group order

The Revenue accounts should be listed first, then Cost of Goods Sold, then Expenses. Left click and drag Revenue to the top of the row labels area:

rearrange pivottable row order

Step 4: Add Calculated Items for Gross Profit and Net Profit

Select one of the Account Group cells in the row labels area of the PivotTable > PivotTable Analyze tab > Fields, Items & Sets > Calculated Item:

excel pivottable calculated item

We’ll create the Gross Profit item first:

excel pivottable calculated item for gross profit

Then one for Net Profit:

excel pivottable calculated item for net profit

They should now appear in the PivotTable row labels.

Step 5: Collapse the Gross Profit and Net Profit Items

This hides the underlying account detail that makes up these values:

excel pivottable collapse rows

Also move Gross Profit up under Cost of Goods Sold using the left click and drag technique covered in step 3.

Step 6: Show Subtotals at Bottom of Group

excel pivottable subtotal position

Step 7: Insert Blank Line after Each Item

excel pivottable blank rows

Step 8: Format PivotTable

Choose a plain style from the gallery on the Design tab or create your own with no formatting, as I’ve done for this example. Then add cell borders for the sub-total and total rows:

excel pivottable format style

Make sure ‘Preserve cell formatting on update’ is on by right clicking the PivotTable > PivotTable Options > Layout & Format tab:

excel pivottable options

Rename the Actual and Budget headings to remove the ‘Sum of’ by replacing them with a space.  We need to add the space at the front of the labels because we cannot use names that are also in the field list.

Hide the Expand and Collapse buttons and Field Headers:

excel pivottable buttons

Remove the Grand Total: right click the Grand Total label > Remove Grand Total:

excel pivottable remove grand total

Step 9: Add a Calculated Field for the Variance (Optional)

excel pivottable calculated field

In the formula field subtract the budget from the actual:

excel pivottable profit and loss variance calculated field

You can also add one for the % Variance if you want:

excel pivottable profit and loss percent variance calculated field

Step 10: Conditional Formatting (Optional)

Profit and loss statements make for dry reading, but we can make it quicker for our audience to interpret with the help of some conditional formatting to visually indicate whether the variance is positive or negative using traffic lights.

Positive income variances are good, but the opposite is true for expense variances, so we need two conditional formatting rules.

Set up the income rule first by selecting just the income related Variance % cells: Revenue, Gross Profit and Net Profit > Home tab > Conditional Formatting > Icon Sets:

excel pivottable profit and loss variance conditional formatting

Repeat for the Cost of Goods Sold and Expenses Variance % cells.

Modify the Conditional Formatting rules: Home tab > Conditional Formatting > Manage Rules…

modify conditional formatting

Select each rule and edit them as per the settings below:

Step 11: Add Slicers (Optional)

If your source data has fields that you’d like to filter your Profit and Loss by, you can add Slicers by selecting a cell in the PivotTable > Insert tab > Slicers

add slicers for pivottable profit and loss

I’ll add them for Region and Financial Year:

add slicers for region and financial year

And your PivotTable Profit and Loss is done:

excel PivotTable Profit and Loss completed

AUTHOR Mynda Treacy Co-Founder / Owner at My Online Training Hub

CIMA qualified Accountant with over 25 years experience in roles such as Global IT Financial Controller for investment banking firms Barclays Capital and NatWest Markets.

Mynda has been awarded Microsoft MVP status every year since 2014 for her expertise and contributions to educating people about Microsoft Excel.

Mynda teaches several courses here at MOTH including Excel Expert, Excel Dashboards, Power BI, Power Query and Power Pivot.

46 thoughts on “Excel PivotTable Profit and Loss”

  1. Mynda,

    I’m a big fan and have taken a couple of your courses.

    Your P&L looks great! I’m trying to create one with formatting that is automatically adjusted when there are more or fewer items in each category. Any suggestions?

    Reply
    • Great to hear, Brian! You can use Conditional Formatting to identify rows that are ‘totals’ and rows that aren’t and apply the formatting accordingly. If you get stuck, please post your question on our Excel forum where you can also upload a sample file and we can help you further.

      Reply
  2. GREAT job as always!
    I laugh when I looked at the P/L b/e I was hired as a consultant to do this but could not find ANYTHING on doing this through DAX; and mightily struggled. NOW, in your model the 1st income line is “Consultancy Income” – and YOU have it! Where were you 5 yrs ago! Things, and teachings are always improving!

    (And I will be going through this in minute detail!)

    Have a Merry Christmas down in OZ!

    Reply
  3. Hi Mynda,

    I am trying to calculate the GP%, but had no luck. Any reason why this does not work. I used GP/Revenue. Thanks Marlon

    Reply
        • Oh, ok. Because the Gross Profit is actually the sum of the accounts that make up the revenue and COGS account groups, as opposed to a calculation in its own right. If you turn the field buttons back on and expand the Gross Profit line, you’ll see the underlying accounts that make it up. It’s just a limitation of regular PivotTables, I’m afraid.

          Reply
  4. Hi Myanda,

    Earlier this week, I was asked by a Manager to draw up a P&L for a Camp ( Resort ) and after searching “hi&lo” for a “how to create a P&L in a pivot table” tutorial, I stumbled on this from 2020 ..
    .. it was exactly what I needed !!
    I had to tweak the “calculated items” formulas for Gross & Net Profit as our Company shows revenue as ( – ), but aside from that, and a couple of revenue variance ( % ) that seem odd, I’m very happy with the result.

    Reply
  5. Dear Teacher

    I am 68 and never learned so fast in my life, I must say you are the best teacher and I salute you for it.

    Be Blessed

    Rathod

    Reply
  6. Very helpful, indeed you are a teacher.
    Have you covered the ones involving trial balance and balance sheet? Do you also have as any tutorial on macros and VBA?

    Reply
  7. Do you have any tutorial how to create P/L using power Pivot, I have my normalized tables in SQL Server, wondering how to do using DAX . Thank you.

    Reply
    • Hi Giovanni,

      No, I don’t have any Power Pivot P&L tutorials. It’s notoriously difficult to create them with Power Pivot.

      Mynda

      Reply
  8. Hi Tracy,

    When I insert the Calculated Items to get the Revenue mins Expense, the Excel show “This PivotTable report field is grouped. You cannot add a calculated item to a grouped field.”

    Can you please advise what went wrong? How can I fix this?

    Thanks a lot.

    Christina

    Reply
    • Hi Christina,

      Sounds like a field in your Pivot Table or cache is grouped. Most likely the date field. Right-click on the fields > ungroup.

      Mynda

      Reply
  9. Hi Mynda,

    I watched your webinar training how to create interactive dashboard and it is excellent. I was able to create my own Sales Order dashboard with your excellent tools and input from the webinar using one big data information. My boss really loves it and he wanted me to add more information using the same dashboard. Unfortunately, the additional information is a totally separate set of data. Am I able to combine two or three sets of data in one dashboard?

    Reply
  10. Dear Mynda

    Simply wonderful!

    By the end of the week, I hope to have completed your free tutorials and webinars, to bring 25 years of Excel use up to a new level. However, I am a pianist and I have approached this a bit like learning a new Chopin Polonaize, which I have done whilst watching and noting your techniques.

    The piano piece is now near to performance standard, but it will not be fit for listening to until my music teacher has a chance to show me how to do it properly and to eliminate mistakes.

    So, I need to ask you which of your courses I should subscribe to so that I can achieve my goal to become a consultant working on a contract basis, using Excel at the highest level.

    I recognise that I have a lot of practising to do, both in Excel and on the piano before I can perform before an audience, so using your courses seems to be the best way I have identified out of about 12 vendors of Excel courses on the web.

    Where should I start Mynda?

    Sincerely

    Steve

    Reply
    • Hi Steve,

      It’s great to hear you found our tutorials helpful and are keen to expand your Excel skills. To work competently as a consultant you need broad Excel skills, as I’m sure you expect. I therefore recommend the following courses:

      • Excel Expert Course – Advanced Excel. This is going to cover everything from the basics (you can skip what you know) right through to the new dynamic array functions, PivotTables, Data Validation, Conditional Formatting and more.
      • Power Query Course – Power Query can automate a lot of the data gathering and cleaning tasks we used automate with VBA, but it’s much quicker and easier to learn.
      • Power Pivot Course – Power Pivot allows Excel to work with big data spread across multiple tables like a relational database and it has its own function language called DAX, that extends the capabilities of regular PivotTables.
      • Excel Dashboards Course – Reporting skills will be key as a consultant. This course will equip you to build dashboard reports for any organization.

      There is detailed information at the above links, but if you have any questions, please get in touch via email (website at MyOnineTrainingHub.com) where we can help you further.

      Mynda

      Reply
      • Thanks, Mynda

        I have signed up for the first two, and will then proceed to the next ones.

        I do hope that you will forgive the piano analogies, but as you amply demonstrate, one needs to be both knowledgeable and fluent to be credible in front of a client (Or an audience!)

        So, the courses will become the start of a lot of practice on the keyboard and with the mouse to memorise all of the details so that when I present to a client, the presentation flows. I have no intention of showing them exactly how to do what I offer, most CEOs and FDs are too busy to become involved at that level, and in any case, from the messes they make of their sales plans and dashboards, they wouldn’t have a clue what was going on.

        I bet that the Chopin reaches performance standard before my Excel gets there!

        From the world of CRM and relational databases, I was often assigned a junior manager to guide me through their “Requirements” Read, “Learn what he does and then be able to do it so we don’t need to hire him again, no matter how good he is”

        It never worked!!

        Sincerely

        Steve

        PS I seem to have been signed up as a member of the Excel Expert course, but not been offered the same option on Power Queries. Do I need to do anything?

        Thanks again.

        Reply
        • Hi Steve,

          Great to have you join our courses. You should see them both available when you login next.

          I hope you enjoy them. We’re here if you have any questions along the way, but please use email or the forum going forward.

          Mynda

          Reply
  11. Hello Mynda,

    I have used this presentation and the result looks very good, thank you for this.

    Now I look for a way to add a column showing actual and budget numbers as percentage of revenue. Example: $93,427 in the new column would show as 14.90% of Revenue Total $626,954.
    What is the best way to calculate this new column, can this be done without DAX or measures, because I am not yet familiar with DAX.

    Many thanks for an answer.

    Reply
  12. Hi Mynda,
    I absolutely loved the pivot tables for profit and loss. My only issue is the data we get from our accounting system is not split into two columns for actual and budget figures. Its tabular form but it comes trough a separate line telling me which is Actual and which is Budget. Thus, I can make it into a pivot but I cant do the calculated fields for the variances. Do you know if power pivot can help with this. I have not explored that area but trying to figure out better ways to speed up our process at work. Thanks!

    Reply
    • Hi Nidia,

      You can use Power Query to Pivot the actual and budget figures into separate columns. If you’re not sure how to do this, post your question and sample Excel file in our forum and we’ll show you how.

      Mynda

      Reply
  13. I need some help with this one. The Calculated field and Calculated Item button is greyed out in my pivot table. My data is in the Data Model. Is that the reason for the greyed out options and how can I fix the problem.

    Reply
    • Correct. When you put your data in the data model aka. Power Pivot, you can’t use calculated fields and items. In Power Pivot you must write DAX measures. To fix it, create a regular PivotTable without adding the data to the data model.

      Reply

Leave a Comment

Current ye@r *