COUNTIFS using a named Range

a8_tony

New Member
Joined
Feb 13, 2017
Messages
5
Good evening from the UK, and please forgive my first post.

I've got a set of data, which has a number of elements. This is all being used in a dashboard for a client, and right now I'm getting just a tad frustrated.

I have a Table (OrdersPickData) which looks like the following:

DeliveryMethodAllocatedQtyPromisedDeliveryDatePickedQty
CARRIER1015/02/20175
CARRIER515/02/20170
DELIVERY - 031015/02/201710
DELIVERY - 04215/02/20170
DELIVERY - 03314/02/20173

<tbody>
</tbody>

I also have a named Range (DelMethod) which consists of the following values (The order is important as it's used in a custom sortlist in VBA):

DELIVERY - 03
DELIVERY - 04
CARRIER
COLLECTION

<tbody>
</tbody>

There are two things I want to achieve:

1. Count the number of lines where the delivery method is in the range DelMethod AND the delivery date = DelDate (a date entered in a cell, 15/02/2017 in this case).

To achieve this I thought I'd use the following function, using CSE to ensure it's an array formula:
{=COUNTIFS(OrdersPickData[DeliveryMethod],DelMethod, OrdersPickData[PromisedDeliveryDate],DelDate)}

The result I expected is 4, but I'm only getting a result of 1. If I change the sort order of the DelMethod range, I get a count of 2. I can directly attribute this to it being alphabetical, but I didn't expect the calculation to stop after only matching the first value it found.

So, I also tried this:
=SUMPRODUCT(COUNTIF(OrdersPickData[DeliveryMethod],DelMethod)) which counts correctly the number of fields in OrdersPickData, but doesn't cross-check to validate if PromisedDeliveryDate also matches.

2. The second thing I want to be able to do, is calculate the quantity allocated, and the quantity picked, using the same filter.

Just to clarify, I need to be finding orders where they are in the DelMethod List AND PromisedDeliveryDate = DelDate

Any help will be most appreciated, as I fear I shall be bald at the end of the evening if I continue.

Thanks in advance :)
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
It can be hard to work out ranges and criteria when using structured tables, can you "translate" that into actual ranges please?
 
Upvote 0
It can be hard to work out ranges and criteria when using structured tables, can you "translate" that into actual ranges please?
Hi FDibbins,

In this example the function would be:

{=COUNTIFS(A1:A6,F1:F4,C1:C6,J3)}

Thanks (Y)
 
Upvote 0
COUNTIFS syntax is...
=countifs(criteria-range1,criteria1,criteria-range2,criteria2,criteria-range3,criteria3.........)
Generally, your criteria needs to be a single cell, it looks like your 1st criteria is a range? F1:F4
 
Upvote 0
It is, but I was under the impression I could use an array as a criteria?

=SUM(COUNTIF(A1:A6,F1:F4)) gives the correct count of the DeliveryMethods. But I need to then combine this with the Delivery date :(
 
Upvote 0
Something like this will work, but I have hard-coded the criteria...
A​
B​
C​
D​
1​
aa
10​
aa
150​
2​
bb
20​
bb
180​
3​
cc
30​
4​
dd
40​
330​
5​
aa
50​
6​
bb
60​
7​
cc
70​
8​
dd
80​
9​
aa
90​
10​
bb
100​
11​
cc
110​
12​
dd
120​
D1 and D2 are just a regular sumifs()
=SUMIF($A$1:$A$12,C1,$B$1:$B$12)
copied down (to show the values)

D4=SUM(SUMIFS($B$1:$B$12,$A$1:$A$12,{"aa","bb"}))
 
Upvote 0

Forum statistics

Threads
1,216,074
Messages
6,128,652
Members
449,462
Latest member
Chislobog

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