Optimization and Filtering

dsdevon06

New Member
Joined
Aug 21, 2023
Messages
14
Office Version
  1. 2021
Platform
  1. Windows
I have two different data sets with similar data but different model numbers. I want to find a discus model that is closest to the reed model based on a certain criteria. That is: Uses the same refrigerant, has the same application, and then the closest capacity. I want this to be robust enough that if the criteria can change. The person who set up this excel previously did not do this. Then once this model is found, it needs outputted in the table to the right with specific data correlating to that discus model.

This was the formula used previously that works but is flawed in its filtering and picking.

=IFERROR(INDEX(A$21:A$25,MATCH(MIN(IF(($E$21:$E$25=$E9)*($C$21:$C$25=$C9)*($I$21:$I$25=$I9)*($J$1=$J$21:$J$25),ABS($G9-$G$21:$G$25))),IF(($E$21:$E$25=$E9)*($J$1=$J$21:$J$25)*($C$21:$C$25=$C9)*($I$21:$I$25=$I9),ABS($G9-$G$21:$G$25)),0)),"-")

Columns M through U and V have similar equations that look through the data set. I tried a pivot table but it gets screwed up with not having exact answers for example, Capacity.
 

Attachments

  • Test Example Photo.PNG
    Test Example Photo.PNG
    81.3 KB · Views: 9
That is still asking me to sign in.
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Ok, for the 1st 2 columns, how about
Book.xlsx
ABCDEFGHIJK
1standard
2All N/A, hard code
3
4Reed Models Listed out
5
6Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8Column 9Column 1Column 2
71AA1-1111N/AAA1R-11A1015000Reed50--
81AA1-1111N/AAA2R-11B1017000Reed601AAAA11AA1DAAA11AA
92BB2-2222N/ABB2R-00C2018000Reed603CCCCC11CC3DCCCC11CC
102BB2-2222N/AAA3R-01D2020000Reed60--
11 --
12
13
14
15
16
17
18Reed Models Listed out
19
20Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8Column 9Unloader Type
211AAAA11AA1DAAA11AAAA1R-11A1116000Discus60Standard
221AAAA11AA1DAAA11AAAA2R-11B1118000Discus60Standard
232BBBBB11BB2DBBBB11BBBB2R-00C2121000Discus60Standard
242BBBBB11BB2DBBBB11BBAA1R-01D2117500Discus602 Bank Unloader
253CCCCC11CC3DCCCC11CCbb2R-00C3118100Discus60Standard
Sheet1
Cell Formulas
RangeFormula
J7:K11J7=LET(f,FILTER(A$21:G$25,($E$21:$E$25=$E7)*($C$21:$C$25=$C7)*($I$21:$I$25=$I7)*($J$1=$J$21:$J$25)),IFERROR(INDEX(SORTBY(f,ABS(G7-INDEX(f,,7))),1,{1,2}),"-"))
Dynamic array formulas.
 
Upvote 0
I just realized that when I told you that the criteria list I wanted that I changed the column names so you don't know.

For cell A7 I want to have the A20:J27 searched and output the value in Column 1 into J7.

The criteria is: Column 4, Column 5, and then closest to Column 7
 
Upvote 0
So you don't to check columns 3, 9 & 10?
 
Upvote 0
Correct. The values in the other columns do not matter at this moment.

If filtering first column 4 and then column 5; then if there are still multiple data points then closest to Column 7 will narrow it to one value that can be outputted into J7
 
Upvote 0
Ok, how about
Book.xlsx
ABCDEFGHIJK
1standard
2All N/A, hard code
3
4Reed Models Listed out
5
6Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8Column 9Column 1Column 2
71AA1-1111N/AAA1R-11A1015000Reed501AAAA11AA1DAAA11AA
81AA1-1111N/AAA2R-11B1017000Reed601AAAA11AA1DAAA11AA
92BB2-2222N/ABB2R-00C2018000Reed603CCCCC11CC3DCCCC11CC
102BB2-2222N/AAA3R-01D2020000Reed602BBBBB11BB2DBBBB11BB
11 --
12
13
14
15
16
17
18Reed Models Listed out
19
20Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8Column 9Unloader Type
211AAAA11AA1DAAA11AAAA1R-11A1116000Discus60Standard
221AAAA11AA1DAAA11AAAA2R-11B1118000Discus60Standard
232BBBBB11BB2DBBBB11BBBB2R-00C2121000Discus60Standard
242BBBBB11BB2DBBBB11BBAA1R-01D2117500Discus602 Bank Unloader
253CCCCC11CC3DCCCC11CCbb2R-00C3118100Discus60Standard
Sheet1
Cell Formulas
RangeFormula
J7:K11J7=LET(f,FILTER(A$21:G$25,($E$21:$E$25=$E7)*($D$21:$D$25=$D7)),IFERROR(INDEX(SORTBY(f,ABS(G7-INDEX(f,,7))),1,{1,2}),"-"))
Dynamic array formulas.
 
Upvote 0
It looks like it is working from this end. Only way for me to completely know is to throw it into my large data set.

In the blue section. I would also like it to pull all of the data for that row and put it with it to the right.

It appears I am having a #SPILL! error in the cell J7. I expanded A21:G25 to encompass the entire data set. Then Moved D to take the whole row same with G.

I get the value in the data set in column D by: =MID(J8,4,LEN(J8)-6)
Column E by: =LEFT(RIGHT(J10,2),1)

*** NOTICED: Are you also having the value go by which value in the data set is closest in column 7. Otherwise it will be trying to output many different values*******
 
Last edited:
Upvote 0
It successfully outputted data. But out of my 57 rows it only outputted 4 rows with values. The rest were "-"

That could mean though that it really doesnt exist. ** Checking via Pivot table**
 
Upvote 0

Forum statistics

Threads
1,215,128
Messages
6,123,206
Members
449,090
Latest member
bes000

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