This site uses cookies, tokens, and other third party scripts to recognize visitors of our sites and services, remember your settings and privacy choices, and — depending on your settings and privacy choices — enable us and some key partners to collect information about you so that we can improve our services and deliver relevant ads.

By continuing to use our site or clicking Agree, you agree that CBS and our key partners may collect data and use cookies for personalized ads and other purposes, as described more fully in our privacy policy. You can change your settings at any time by clicking Manage Settings.

Software Microsoft

Office Q&A: Excel built-ins and helper formulas

This month, Susan Harkins supplies different solutions for the same problem using Microsoft Excel.

Image: Susan Harkins

If you're familiar with most of Excel's features, you know that there's almost always more than one way to get the information you need from your data. On the other hand, if you're not familiar with all the features, you might spend a lot of time trying to write a complex formula, unnecessarily. This month, I help Kay track outstanding invoice amounts by adding two helper columns and then using Excel's Subtotal, PivotTable, and Table object--no impossibly difficult formulas, no hair-pulling, and no gnashing of teeth!

I'm using Windows 7 and Excel 2007 and 2013. You can download the .xlsx or .xls demonstration file, but my old XP/2003 system is in the shop, so there are no 2003 instructions for this article. The Table object isn't supported by 2003.

A Subtotal solution

Kay tracks invoices, and she wants to sum outstanding invoice amounts that are 30 and 60 days out from the invoice date for each supplier. There are so many ways to do this, but I'll show you how to use the built-in tools to get the job done without code or complex formulas.

The simple data set shown in Figure A uses the TODAY() function to display the current date. By referring to a cell instead of a literal TODAY() function in the formulas, the solution is a bit more flexible, because you can easily change the anchor date.

Figure A

Image: Susan Harkins
Invoice tracking.

First, we'll add formulas to identify invoices that are 30 and 60 days past the invoice date. We'll also add a helper column that calculates the total number of days between the invoice date and the current date, so you can see the calculations at work. All of these calculations can be added to a single formula, but I find helper columns easier to manage. Then, we'll use the Subtotal feature to total outstanding amounts for each supplier.

To get started, enter the following formulas and copy them to the remaining data set:

G4: =IF(F4="",$C$1-D4,0)

H4: =IF(AND(G4>$H$3,G4<=$I$3),E4,"")

I4: =IF(G4>$I$3,E4,"")

Figure B shows the results of these formulas. Column G returns the total number of days beyond the invoice date if the invoice hasn't been paid. Column H returns the invoice amount for those invoices that are unpaid and where the invoice date is greater than 30 days and less than or equal to 60 days. Column I returns the invoice amount for those invoices that are unpaid and where the invoice date is greater than 60 days. When applying this to your own work, be sure to pay close attention to the equality operators to get the right results for your organization.

Figure B

Image: Susan Harkins

Helper columns.

Now, let's use the Subtotal feature to sum outstanding amounts by suppliers. First, you must sort by the grouping value, which (in this case) is the Supplier as follows:

  1. Click any cell in the Supplier column (C4:C8).
  2. On the Home tab, click Sort & Filter in the Editing group.
  3. Choose Custom Sort.
  4. In the resulting dialog, choose Supplier from the Sort by drop-down.
  5. Choose Values from the Sort On drop-down.
  6. Choose A to Z from the Order drop-down.
  7. Be sure to check the My data has headers options (Figure C).
    Figure C
    Image: Susan Harkins
  8. Click OK.

Subtotal feature relies on sorted data. You can't skip the sort unless your data is already in order by the grouped values. You can choose a more complex sort by adding sort levels. In addition, your data might not have headers; the example data does.

After sorting, you're ready to apply the Subtotal feature as follows:

  1. Click anywhere inside the data set.
  2. Click the Data tab and then click Subtotal in the Outline group.
  3. In the resulting dialog, choose Supplier from the At each change in drop-down.
  4. Choose Sum from the Use function drop-down.
  5. Check the 30 and 60 options in the Add subtotal to list (Figure D).
    Figure D
    Image: Susan Harkins
  6. Click OK to see the totals in Figure E.
    Figure E
    Image: Susan Harkins

With a few simple formulas, a quick sort, and the Subtotal feature, you can see the following:

  • Jones has a total of $30 that's 60 days or older.
  • Michaels has $92 that's between 30 and 60 days old.
  • Michaels has $30 that's 60 days or older.

When applying Subtotal to your own work, remember that Excel can't use Subtotal with data stored in a Table object.

A PivotTable solution

As is almost always the case, you can also use a PivotTable. Figure F shows a simple PivotTable based on the Supplier, 30, and 60 day columns.

Figure F

Image: Susan Harkins
Use a PivotTable.

To generate this PivotTable, do the following:

  1. Click anywhere inside the data set.
  2. On the Insert tab, click PivotTable in the Tables group.
  3. In the resulting frame, drag Supplier to the Row Labels section, and drag 30 and 60 to the Values section Figure G.
    Figure G
    Image: Susan Harkins
  4. If the 30 and 60 columns default to a count instead of a sum, choose Value Field Settings from the field's drop-down, choose Sum, and then click OK.

Don't forget that you must refresh (update) a PivotTable when the underlying data changes. Click inside the PivotTable and then click the contextual Analyze tab. In the Data group, click Refresh (or right-click the PivotTable and choose Refresh).

A Table solution

Perhaps my favorite solution is the Table solution. It's the easiest, in my opinion, but the Table object has limitations. For instance, you can't use Subtotal on a Table, so keep these limitations in mind before choosing a Table.

To convert the text to a Table, do the following:

  1. Click inside the data set.
  2. On the Insert tab, click Table in the Tables group.
  3. In the resulting dialog, be sure to check the My table has headers option.
  4. Click OK.

I ran into a bit of a snag with the Table object; even after formatting the 30 and 60 in the heading labels as Number, the formulas still didn't work because the Table object doesn't like digits in a header. To simplify this example, I dropped those values in above the Table object's header row, as shown in Figure H. You could just as easily enter the literal values in the formulas, but I think references add flexibility, because you can quickly change the outstanding days component without updating the formulas.

Figure H

Image: Susan Harkins
Move the outstanding values out of the Table object's header.

You'll also need to update the formulas in columns H and I:

Column H: =IF(AND(G4>$H$2,G4<=$I$2),E4,"")

Column I: =IF(G4>$I$2,E4,"")

The header references now reference the new values in H2 and I2. Next, display the Total row by checking the Total Row option in the Table Style Options group on the contextual Design tab. To display sums in this new row, choose Sum from the Total drop-down for columns H (Figure I) and I.

Figure I

Image: Susan Harkins
Choose the Sum function.

The Table sums the entire data set, but the Table object offers filtering features. From the Supplier drop-down, choose a supplier (Figure J).

Figure J

Image: Susan Harkins
Filter by supplier.

Click OK, and watch the Sum functions in the Total row update accordingly, as shown in Figure K.

Figure K

Image: Susan Harkins
Outstanding total for a specific supplier.

If you don't want to use the Table object, you can use Excel's Filter feature in the same way, but you'll have to add the totals row manually. For more information, read the section Count filtered records in "Four useful Excel filtering behaviors" and replace the function argument 2 with 9: =SUBTOTAL(9,B4:B10).


I've shared three simple and easy-to-implement solutions. None is superior to the others. The way you use your data will determine the solution that's best for you.

Send me your question about Office

I answer readers' questions when I can, but there's no guarantee. When contacting me, be as specific as possible. For example, "Please troubleshoot my workbook and fix what's wrong" probably won't get a response, but "Can you tell me why this formula isn't returning the expected results?" might. Please mention the app and version that you're using. Don't send files unless requested; initial requests for help that arrive with attached files will be deleted unread. I'm not reimbursed by TechRepublic for my time or expertise when helping readers, nor do I ask for a fee from readers that I help. You can contact me at

Also see

Visit TechRepublic