# Exel 2007: Running subtotal based on data in 2 cells

**URL:** <https://boards.straightdope.com/t/exel-2007-running-subtotal-based-on-data-in-2-cells/647745>\
**Category:** Factual Questions\
**Created:** [January 19, 2013, 9:51pm UTC](https://boards.straightdope.com/t/exel-2007-running-subtotal-based-on-data-in-2-cells/647745 "2013-01-19T21:51:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lok](https://avatars.discourse-cdn.com/v4/letter/l/e8c25b/32.png) [@Lok](https://boards.straightdope.com/u/Lok)\
**Post date:** [January 19, 2013, 9:51pm UTC](https://boards.straightdope.com/t/exel-2007-running-subtotal-based-on-data-in-2-cells/647745/1 "2013-01-19T21:51:27Z")

</div>

I’m trying to determine costs based on when they were paid out. Currently, it is set up like this:

```auto

ColA ColB ColC ColD
Date Amount Paid

2011 $50 Y 0
2012 45 N 1
2012 75 Y 1
2012 10 N 1
2013 50 Y 2
2013 50 N 2

```

ColD is based on the year, it is hidden at the end of the end of the columns and I am using it for something else, so I figure I can use it to determine the year instead of testing the date over and over. I can use ColE, with an IF statement like IF(AND(ColC1=Y,ColD=0),ColB1,0) for the entire column, then add that total when I want it. But then I will need a ColF to check for ColC equaling Y and ColD equaling 1, adding that column for the 2012 total. The problem is basically needing to add another column for each successive year.

Is there anyway to check ColC and ColD, keeping a separate subtotal for each year as the 2 criteria are met?

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [January 19, 2013, 10:06pm UTC](https://boards.straightdope.com/t/exel-2007-running-subtotal-based-on-data-in-2-cells/647745/2 "2013-01-19T22:06:18Z")

</div>

SUMIFS(Amount, Paid, “Y”, ColD, 0) ?

---

<div class="post-metadata">

**Author:** ![Lok](https://avatars.discourse-cdn.com/v4/letter/l/e8c25b/32.png) [@Lok](https://boards.straightdope.com/u/Lok)\
**Post date:** [January 19, 2013, 10:31pm UTC](https://boards.straightdope.com/t/exel-2007-running-subtotal-based-on-data-in-2-cells/647745/3 "2013-01-19T22:31:05Z")

</div>

> [@Ximenean](#):
>
> SUMIFS(Amount, Paid, “Y”, ColD, 0) ?

:smack: I knew there was an easy way to do it, I just couldn’t think of SUMIFS. Duh! Thanks, now I just need to get the time to fix it before I leave tomorrow.
