Sumifs array question

cuddy89

New Member
Joined
Nov 26, 2019
Messages
17
Office Version
  1. 2016
Platform
  1. Windows
I would be very grateful for assistance with the following query which I have spent a while trying to figure out (on a Sunday!)

Please see the attached spreadsheet which contains some sample data.

In column Z, I require columns G,L,N and Q to be summed based on the date to their right, so H,M,P and R.

This is conditional on the below:

There being a date in column U (so non-blank).

The date in column U being greater or equal to the date in column X

The dates in H,M,P and R need to be less than or equal to the date in column Y

Where I am coming unstuck is when column U's date is earlier than the date in any of H,M,P and R

For example, for row 2, £15,366.33 would be the value given in cell Z2, but then £29,636.47 would be given in cell Z5 for row 2.

I think I need to write a sumifs formula in an array for this, but I am struggling to work out how to write this.

Thanks in advance.

Richard
 

Attachments

  • SUMIF array query.png
    SUMIF array query.png
    47 KB · Views: 17
So you're saying that 15,366.33 should not be the answer in Z2?
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
So you're saying that 15,366.33 should not be the answer in Z2?
No, it shouldnt.

I have attached a picture highlighting which values go in which Z cell (and removed deposits just to keep it simple, my problem remains the same).

The formula in Z needs to work as follows:

When there is a date in U, any of L,N,Q and S which have a corresponding date to the right (M,P,R,T) which is less than or equal to U, are summed if U falls between the values in X and Y

The 2 cells highlighted green (L2,L3) are summed in Z5 as their date in column M is after the date in column U, so need to be summed between the correct X and Y values.

I hope that makes sense.
 

Attachments

  • Query.png
    Query.png
    29.1 KB · Views: 3
Upvote 0
We seem to have changed columns now too. Can you move column N next to P, since it's the only one that is not dependent on the column immediately to the right, and that throws any pattern out.
 
Upvote 0
Sorry Rory, too many spreadsheets open!

To confirm, only L, N and Q.

You can delete out column O on Alex's XL2BB sheet if you like as it isnt needed to write the formula.
 
Upvote 0
But is it actually there in your real sheet? It should be a relatively straightforward SUMPRODUCT formula if each value column is immediately to the left of the relevant date column, but in your picture that one is not - it's two columns to the left. That will make it much harder to write a simple formula.
 
Upvote 0
Yes it is there in my real sheet, but if you need me to move columns around in order for you to be able to solve my query then I can do.
 
Upvote 0
If you can move it, then I think this would work:

Excel Formula:
=SUMPRODUCT(($U$2:$U$4>=X2)*($M$1:$T$1="Date Paid")*($M$2:$T$4<=Y2)*$L$2:$S$4)

adjust the row numbers as needed.
 
Upvote 0
Thanks Roy

I have tried using this but it doesn't seem to account for when the date paid is greater than the date receipted in.

So the payments in L2 and L3 are not being summed in Z5 (as on the attached picture).

I think this is because the first part of the formula - SUMPRODUCT(($U$2:$U$4>=X2) will not return a value for Z5

Please can you let me know if you have a solution to this.
 

Attachments

  • Query.png
    Query.png
    29.1 KB · Views: 4
Upvote 0
Per your requirements:

When there is a date in U, any of L,N,Q and S which have a corresponding date to the right (M,P,R,T) which is less than or equal to U, are summed if U falls between the values in X and Y
 
Upvote 0
Sorry Roy, they also need to be summed if U is less than or equal to the values between X and Y, but the date in M,P,R,T falls between the values in X and Y
 
Upvote 0

Forum statistics

Threads
1,215,544
Messages
6,125,444
Members
449,226
Latest member
Zimcho

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top