Counting distinct rows based on multiple criteria without Array formulas

wdee

New Member
Joined
Jun 24, 2020
Messages
3
Platform
  1. Windows
Hello!

This is my first post, but I'm a long time lurker :) and up until now I always found a solution on your forum but this time I'm really stuck.
So here is the problem.

I need to count the number of orders of some type (C or I) in an export file where I have multiple lines for every item on order.
I know how to do it with array function but it takes too much time to do it. Export is about 10000 rows at a time.... any workaround for this?
Problem1.xlsx
ABCDEFGHIJK
1Order numberType of orderFruitQTYPriceAmount
21CApple41,054,2Type of orderCount
31CBanana20,20,4C7
41CMango30,51,5I4
51IStrawberry40,10,4
61IApple21,052,1
71IBanana60,21,2
82CApple41,054,2
92CBanana20,20,4
102CMango30,51,5
113CStrawberry220,12,2
123CApple411,0543,05
134CBanana130,22,6
145CStrawberry220,12,2
156CApple411,0543,05
167CBanana130,22,6
172IApple41,054,2
183IBanana20,20,4
194IMango30,51,5
Problem
Cell Formulas
RangeFormula
K3:K4K3=SUM(IF((J3=Type_of_order),1/COUNTIFS(Type_of_order,J3,Order_number,Order_number)),0)
F2:F19F2=D2*E2
Press CTRL+SHIFT+ENTER to enter array formulas.
Named Ranges
NameRefers ToCells
Order_number=Problem!$A$2:$A$1048576K3:K4
Price=Problem!$E$2:$E$1048576F2
QTY=Problem!$D$2:$D$1048576F2
Type_of_order=Problem!$B$2:$B$1048576K3:K4
 

Attachments

  • Problem.JPG
    Problem.JPG
    81.8 KB · Views: 13

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
The reason your formula is slow, is that you are looking at the entire column, you should never do that with array formulae.
Try limiting the the ranges to 15,000 rows.
 
Upvote 0
The reason your formula is slow, is that you are looking at the entire column, you should never do that with array formulae.
Try limiting the the ranges to 15,000 rows.
Thank you!
I'm aware that my ranges are through the entire column, but it did not occur to me at all that could solve my problem. Instead, I was looking for a workaround.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
I think power query is a good way. do you familiar with it?
1592998755182.png
 
Upvote 0
Thank you, but I can't use power query because I have report sheet where all statistics are calculated...
 
Upvote 0
Thank you, but I can't use power query because I have report sheet where all statistics are calculated...
You can right click on the result and select Refresh to update the result of PQ, do not need do all the procedures again.
If you do not consider PQ, may be you will also not consider Pivot Table. Considering the large data you have, may be helper columns will reduce the time of calculation.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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