# SUMIFS and ranges Puzzler

#### ptf205

##### New Member
Excel2013/Win7. This has been driving me crazy all afternoon. It boils down to this:

- I want to add the values in a row (K24:AT24 is the sum range), whenever the corresponding cell in the range (K36:AT36 criteria range) is less than the corresponding cell in the range (K48:AT48 criteria).

I.e., if K36<K48 then K24 is included in SUM, if L36<L48 then L24 is included, and so on...

*Formula =SUMIFS(\$K\$24:\$AT\$24,\$K\$36:\$AT\$36,"<"&\$K\$48:\$AT\$48)

The thing that has me most puzzled is that it actually gives me different results depending on in which column the formula is located (and it's the exact same formula, it's not that the cell reference are changing or anything).

When the formula is in a cell in column L for example the result is 2,764, when the formula is in column U it gives me 3,493. The 2,764 result seems to be adding up through the first six columns in the range and stopping (K24:R24) instead of going through the full K24:AT24 range. When the formula is located in a column further out in the sheet however, it will correctly sum all the values in the range that meet the criteria.

What is going on here?!!

### Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

#### martindwilson

##### Well-known Member
use sumproduct
=SUMPRODUCT((K36:AT36<K48:AT48)*K24:AT24)

#### ptf205

##### New Member
Sorry part looks to have been cut off...

"I.e., if K36<K48 then K24 is included in SUM, if L36<L48 then L24 is included, and so on...

*Formula =SUMIFS(\$K\$24:\$AT\$24,\$K\$36:\$AT\$36,"<"&\$K\$48:\$AT\$48)

#### Andrew Poulsom

##### MrExcel MVP
Try:

=SUMPRODUCT(--(\$K\$36:\$AT\$36<\$K\$48:\$AT\$48),\$K\$24:\$AT\$24)

#### ptf205

##### New Member
thanks, but this is actually part of a larger formula that has a few other criteria in addition to the one above (I removed the rest of the criteria to try and "debug" and narrowed it down to the one problem). So I don't think (correct me if I'm wrong) that sumproduct can handle all the additional criteria, including some that are not of the same dimensions as sum range.

#### ptf205

##### New Member
Thanks Andrew, that does work for the above...but this is actually part of a larger formula that has a few other criteria in addition to the one above (I removed the rest of the criteria to try and "debug" and narrowed it down to the one problem). So I don't think (correct me if I'm wrong) that sumproduct can handle all the additional criteria, including some that are not of the same dimensions as sum range.

#### martindwilson

##### Well-known Member
" including some that are not of the same dimensions as sum range" nor can countifs but countifs wont work on comparing ranges

#### ptf205

##### New Member
Here's the full formula if it helps - the other criteria are working fine, but just the one above is not ...

=SUMIFS(\$K24:\$AT24,\$K11:\$AT11,"<"&M\$55,\$K11:\$AT11,">"&L\$55,\$K36:\$AT36,"<"&\$K48:\$AT48)

Thanks again

#### ptf205

##### New Member
Thanks, So you're saying that SUMIFS won't work comparing two ranges to each other? I was thinking that Excel would compare the relative positions of the cells, but if that's not the case I wonder why it's working whenever the formula is place in a cell that's further out in the spreadsheet.

#### Andrew Poulsom

##### MrExcel MVP
Your SUMIFS formula will compare each cell in K36:AT36 with each cell in K48:AT48, but will only return the result of one comparison. Use the Evaluate Formula tool to see what's happening. For SUMPRODUCT:

=SUMPRODUCT(--(\$K11:\$AT11 < M\$55),--(\$K11:\$AT11>L\$55),--(\$K\$36:\$AT\$36 < \$K\$48:\$AT\$48),\$K\$24:\$AT\$24)

Replies
2
Views
276
Replies
2
Views
704
Replies
1
Views
211
Replies
32
Views
2K
Replies
15
Views
937

1,195,849
Messages
6,011,955
Members
441,657
Latest member
Diupsy

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back