Simpler/faster way to filter unique list

danhendo888

Board Regular
Joined
Jul 15, 2019
Messages
167
Office Version
  1. 365
Platform
  1. Windows
The below table is my data.

My worksheet consists of order numbers. In my desired output I am trying to put a unique list of part names as shown below.

Currently I am using this formula =ARRAYTOTEXT(SORT(UNIQUE(FILTER(C2:C7,(A2:A7=A16)*(B2:B7="R"))))) but it seems to make my excel file operate slowly whenever I move around the workbook.

Would there be a faster formula to achieve the same output using formulas?

Book1
ABC
1Order NumberR/EPart
2593924ROil
3593924RWheel
4593924RTyre
5111111111E
6111111111E
7111111111E
8
9
10
11
12
13
14
15Order Number
16593924Oil, Tyre, Wheel
Sheet1
Cell Formulas
RangeFormula
B16B16=ARRAYTOTEXT(SORT(UNIQUE(FILTER(C2:C7,(A2:A7=A16)*(B2:B7="R")))))
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You could try to replace ARRAYTOTEXT by TEXTJOIN but the functions you are using should not slow down your workbook. Any chance you are e.g. using some volatile functions like OFFSET?
 
Upvote 0
I have the below formulas across many columns in just one sheet. But it's very slow when auto refreshing.
I'm planning to copy paste these formulas onto more than 20 sheets in the same excel workbook, so I'm not sure how that would work considering it takes long to update on just the one sheet at the moment

=SUMIFS($AD:$AD,$R:$R,$A1182:$A1350,$AA:$AA,"R")
=SUMIFS($AD:$AD,$R:$R,$A1182:$A1350,$S:$S,K$1179)+SUMIFS($AD:$AD,$R:$R,$A1182:$A1350,$S:$S,K$1180)+SUMIFS($AD:$AD,$R:$R,$A1182:$A1350,$S:$S,K$1178)
=IF(COUNTIFS($S:$S,K1179,$R:$R,$A1182:$A1350,$AA:$AA,"r"),"Yes", "No")
=IFERROR(ARRAYTOTEXT(SORT(UNIQUE(FILTER(FILTER($S:$S,($R:$R='Sheet2'!$A1182)*($AA:$AA="R")),ISNA(XMATCH(FILTER($S:$S,($R:$R='Sheet2'!$A1182)*($AA:$AA="R")),$AQ$1174:$AQ$1180)))))),"")
=ARRAYTOTEXT(SORT(UNIQUE(FILTER($S:$S,($R:$R='Sheet2'!$A1182)*($AA:$AA="E")))))
 
Upvote 0
Get rid of the whole column references in the last two formulae, that is probably what is slowing down the file.
Also you can change the 2nd formula to
Excel Formula:
=sum(SUMIFS($AD:$AD,$R:$R,$A1182:$A1350,$S:$S,torow(K$1178:K$1180)))
 
Upvote 1
Solution
MrExcel.xlsm
UVWY
24464Shipment NumberCodeRevenue or ExpenseUSD
24465236371901WheelR(10.00)
24466236371901GearboxE2.00
24467236371901TyreR(22.00)
24468236371901GasE5.00
24469236371901FuelE10.00
24470236371901RimsR(4.00)
24471236371922TyreR(44.00)
24472236371922GasE20.00
24473236371922FuelE50.00
24474236371922RimsR(100.00)
Raw Data


MrExcel.xlsm
RST
24477SUMTyre
24478Rims
24479Fluff's Formula Test:
24480236371901-170
24481236371922
24482
24483
24484
24485
24486
24487Get unique Codes butRE
24488Exclude These -->WheelGas
24489
24490236371901Rims, TyreFuel, Gearbox
24491
24492RE
24493All unique codes -->Rims, Tyre, WheelFuel, Gas, Gearbox
Raw Data
Cell Formulas
RangeFormula
S24480S24480=SUM(SUMIFS($Y:$Y,$U:$U,R24480:R24481,$V:$V,TOROW(S24477:S24478)))
S24490S24490=IFERROR(ARRAYTOTEXT(SORT(UNIQUE(FILTER(FILTER('Raw Data'!$V:$V,('Raw Data'!$U:$U=R24490)*('Raw Data'!$W:$W="R")),ISNA(XMATCH(FILTER('Raw Data'!$V:$V,('Raw Data'!$U:$U=R24490)*('Raw Data'!$W:$W="R")),S24487:S24488)))))),"")
T24490T24490=IFERROR(ARRAYTOTEXT(SORT(UNIQUE(FILTER(FILTER('Raw Data'!$V:$V,('Raw Data'!$U:$U=R24490)*('Raw Data'!$W:$W="e")),ISNA(XMATCH(FILTER('Raw Data'!$V:$V,('Raw Data'!$U:$U=R24490)*('Raw Data'!$W:$W="e")),T24488:T24489)))))),"")
S24493S24493=ARRAYTOTEXT(SORT(UNIQUE(FILTER($V:$V,($U:$U=R24490)*($W:$W="r")))))
T24493T24493=ARRAYTOTEXT(SORT(UNIQUE(FILTER($V:$V,($U:$U=S24490)*($W:$W="E")))))


Oh wow, thank you for your formula 🙏
Although, is it supposed to work as an array formula?

Regarding getting rid of the whole column references in the last two formulae, I'm currently pointing to it like that because the column has either R or E values (representing revenue or expenses).
I'm trying to extract unique codes for either revenue or expense (while excluding specific codes).
For example, for this shipment, the revenue codes are: "Wheel, Tyre, Rims". And if we exclude Wheel, then the output should is: "Rims, Tyre"

As for the other formula, that is just producing all the codes for either revenue or expense for each shipment.

The table of data has many rows and columns, this is just a reduced version for reference.
 
Last edited:
Upvote 0
You should never use entire columns when using arrays, limit the range to something more suitable like
Excel Formula:
=ARRAYTOTEXT(SORT(UNIQUE(FILTER($V2:$V50000,($U2:$U50000=R24490)*($W2:$W50000="r")))))
 
Upvote 1
You should never use entire columns when using arrays, limit the range to something more suitable like
Excel Formula:
=ARRAYTOTEXT(SORT(UNIQUE(FILTER($V2:$V50000,($U2:$U50000=R24490)*($W2:$W50000="r")))))

Oh I see, noted, will do.

For your SUMIFS/TOROW formula, I've put it in cell S24480, is it supposed to work as an array formula so that the results spill down? Or should I use each row (e.g. R24480) as the search value?
Also, would one be faster than the other, or both would operate at the same speed?
 
Upvote 0
No it's not meant to spill, it will do exactly what the formula you posted does.
 
Upvote 1

Forum statistics

Threads
1,223,883
Messages
6,175,167
Members
452,615
Latest member
bogeys2birdies

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