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

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
I thought someone would reply so I overlooked. Sorry for late response. Try this in Z2 and below...

Excel Formula:
=IF(AND(U2<>"",U2>=X2,H2<=Y2,M2<=Y2,P2<=Y2,R2<=Y2),G2+L2+N2+Q2,"")
 
Upvote 0
You are going to find it difficult to get people to buy into this without providing an XL2BB of your data rather than a picture, that is quite a bit of data to set up to test out a formula. (Sanjay has a link to the XL2BB tool in his signature block)

I don't understand what this means:
but then £29,636.47 would be given in cell Z5 for row 2.


Anyway below is a bit of a brute force approach. Give that a try.

20220926 Add Up column based on assoc dates cuddy89.xlsx
GHIJKLMNOPQRSTUVWXYZAA
1DepositDate PaidFOB TotalTotal PaymentDate PaidDutyVATDate PaidFreightDate PaidDeferment feeDate PaidDate receipted inW/CW/ECollectionsOrig Collections
22,910.0029/07/202232,546.4729,636.4714/09/20224,567.8912,345.6719/08/20227,654.3219/08/2022234.1219/08/202226/08/202222/08/202228/08/202215,132.2144,768.68
312,345.6712,345.6714/09/20221,234.233,026.5423/08/20222,000.0023/08/202242.5723/08/202226/08/202229/08/20224/09/2022-15,579.90
43,500.005/08/202233,500.0030,000.0016/09/20223,000.0010,000.0018/09/20223,000.0018/09/202253.4218/09/20225/09/202211/09/2022-39,500.00
512/09/202218/09/2022--
Sheet1
Cell Formulas
RangeFormula
Z2:Z5Z2=IF(AND(U2<>"",U2>=X2), (((H2<=Y2)*(H2<>""))*G2 + ((M2<=Y2)*(M2<>""))*L2 + ((P2<=Y2)*(P2<>""))*N2 + ((R2<=Y2)*(R2<>""))*Q2), 0)
AA2:AA5AA2=G2+L2+N2+Q2
 
Upvote 0
Hi Both

Sorry for my delay in replying, I've only just had chance to look at this.

Thank you for your responses.

Sanjay, your formula works when comparing line by line, but what I'm struggling to work in to the formula is summing the range of the H to U columns.

So I would need these to be something like:

=IF(AND(U2:U50<>"",U2:U50>=X2,H2:H50<=Y2,M2:M50<=Y2,P2:P50<=Y2,R2:R50<=Y2),G2:G50+L2:L50+N2:N50+Q2:Q50,"")

To clarify, cell Z2 needs to look at the full range of data, and only X and Y will be cell references, not ranges.

This is why I think I need a SUMIF formula, and possibly an array.

Alex, I need my IT colleague to install XL2BB for me as I don't have permissions (which I'm getting done). I am grateful for you inputting the data for me.

I think my explanation to Sanjay above may answer your query re the £29,636.47 in cell Z5, but to clarify:

As the formula needs to look at the full range of values in the relevant columns from H to U, cell Z5 will pick up the £29,636.47 from cell L2 as this was paid on 14/09/22, which falls in the date range of X5 and Y5.

I hope this helps, apologies if I wasn't clear enough in my original post.

Thanks

Richard
 
Upvote 0
cell Z2 needs to look at the full range of data, and only X and Y will be cell references
To the best of my knowledge add a helper column in Column V and get the desired results in Z2 based on that column V
 
Upvote 0
To clarify, cell Z2 needs to look at the full range of data, and only X and Y will be cell references, not ranges.
I'm not sure I follow your desired results then. Why is the first row result seemingly not including the second row of data, which seems to match all the criteria?
 
Upvote 0
I'm not sure I follow your desired results then. Why is the first row result seemingly not including the second row of data, which seems to match all the criteria?
Sorry, I'm not sure what you mean. Are you referring to Z3? The formula in Z3 on the XL2BB only looks at row 3, which has dates in columns H to U outside the range of X3 to Y3.

If the formula in Z3 looks at the full range of data, Z3 should still be blank as all dates fall outside the X3 to Y3 range, whilst Z5 should contain values from rows 2 and 3
 
Upvote 0
Sorry, I'm not sure what you mean. Are you referring to Z3? The formula in Z3 on the XL2BB only looks at row 3, which has dates in columns H to U outside the range of X3 to Y3.

If the formula in Z3 looks at the full range of data, Z3 should still be blank as all dates fall outside the X3 to Y3 range, whilst Z5 should contain values from rows 2 and 3
No I mean why isn’t Z2 including the data from row 3? You said you wanted each formula to include all matching rows of data.
 
Upvote 0
No I mean why isn’t Z2 including the data from row 3? You said you wanted each formula to include all matching rows of data.
That is what I am struggling with - both answers above only compare the formula in column Z with the corresponding row.

I would be grateful for any advice on this, I'm still struggling to make it work
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,513
Members
448,967
Latest member
screechyboy79

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