Extract a List of Values Filtered by Criteria with Sub-Arrays Tutorial Help

CobraWave

New Member
Joined
Mar 28, 2014
Messages
3
Hi all.

I'm looking to create a formula which will let me pick out rows which contain certain parameters (in various columns).

This tutorial proceeds to explain this, but only allows for one search parameter; I'd like multiple parameters.

Extract a List of Values Filtered by Criteria with Sub-Arrays in Excel

Using the template given, I've modified the code to include an AND statement nested in the IF, theoretically solving my issue. But it doesn't work. All that is output is the very first row of the database, whether it fulfills the requirements or not.

My data structure is identical to the one given in the tutorial.

Here is my modified formula:

Code:
=IFERROR(
    INDEX('Car Data'!B$2:B$1156,
        SMALL(
            IF(
                AND(
                    'Car Data'!$H$2:$H$1156>='Filtered List'!$A$2,
                    'Car Data'!$E$2:$E$1156='Filtered List'!$B$2
                ),
                ROW('Car Data'!B$2:B$1156)-ROW('Car Data'!B$2)+1
            ),
            ROWS('Car Data'!B$2:'Car Data'!B2)
        )
    )
,"")

The value for 'Filtered List'!$A$2 is set as 35, and the value for 'Filtered List'!$B$2 is set as 3.

Working with the template given, this should search for all cars which have greater than or equal to 35mpg and exactly 3 cylinders. But like I said there's an error somewhere.

And yes, I have dragged down the selection so the array is able to output completely, but all is output is Car Data Row 2.

Thanks.
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
It is #N/A

This looks like a consequence of unequally sized ranges. You probably made a mistake while naming the ranges. Would you check whether this is the case? (Note. The MATCH bit is ok, that is, it matches a range against itself as intended.).
 
Upvote 0
I double checked the name manager and the ranges go through the same rows, $2:$3000. I made sure that each one named range is entered in the formula at the correct place. I was trying to focus on the first formula in cell A9 since that one is shorter and returns the error.

=SUM(IF(FREQUENCY(IF(Account<>"", IF((FSLine=$O$4)*(Company=$O$5)*(Pool=$O$6), MATCH(Account,Account,0))),Ivec),1))

I changed Crange to Account, Frange to FSLine, Grange to Company and Lrange to Pool. I also deleted a column in the B (KCO) sheet so the absolute references changed to column O instead of P.

Going through the evaluate formula function, the only time it returns an #N/A is when it reaches the second Account range in the MATCH function. My data in the Account range only runs through row 1431, but the account range is set to 3000. I did that so I wouldn't have to update the formulas if the data is extended. The #N/A is returned from row 1432 to 3000 because there is no data on those rows. Is this the problem?

Thanks again.
 
Upvote 0
I double checked the name manager and the ranges go through the same rows, $2:$3000. I made sure that each one named range is entered in the formula at the correct place. I was trying to focus on the first formula in cell A9 since that one is shorter and returns the error.

=SUM(IF(FREQUENCY(IF(Account<>"", IF((FSLine=$O$4)*(Company=$O$5)*(Pool=$O$6), MATCH(Account,Account,0))),Ivec),1))

I changed Crange to Account, Frange to FSLine, Grange to Company and Lrange to Pool. I also deleted a column in the B (KCO) sheet so the absolute references changed to column O instead of P.

Going through the evaluate formula function, the only time it returns an #N/A is when it reaches the second Account range in the MATCH function. My data in the Account range only runs through row 1431, but the account range is set to 3000. I did that so I wouldn't have to update the formulas if the data is extended. The #N/A is returned from row 1432 to 3000 because there is no data on those rows. Is this the problem?

Thanks again.

Did you also adjust Ivec? It should now be:

=ROW(Account)-ROW(INDEX(Account,1,1))+1

Does this resolve the trouble?
 
Upvote 0
Sorry, I might not have been clear earlier. That name was already updated so I am still receiving the error.
 
Upvote 0
Sorry, I might not have been clear earlier. That name was already updated so I am still receiving the error.

Would you ran the following formulas and report back the results?

=COUNTIFS(Account,#N/A)

=COUNTIFS(FSLine,#N/A)

=COUNTIFS(Company,#N/A)

=COUNTIFS(Pool,#N/A)
 
Upvote 0
Would you ran the following formulas and report back the results?

=COUNTIFS(Account,#N/A)

=COUNTIFS(FSLine,#N/A)

=COUNTIFS(Company,#N/A)

=COUNTIFS(Pool,#N/A)

There were some #N/A values in the Pool range. I fixed those and it solved the #N/A errors. Thank you!

I do have another issue. It is listing repeating values. The data set includes multiple rows where all the three conditions will be the same. Is there a way to eliminate these?

Thanks again!
 
Upvote 0
There were some #N/A values in the Pool range. I fixed those and it solved the #N/A errors. Thank you!

You are welcome.

I do have another issue. It is listing repeating values. The data set includes multiple rows where all the three conditions will be the same. Is there a way to eliminate these?

Thanks again!

The formulas I provided gives you a unique list of accounts. So, I fail to understand what you are trying to say here?
 
Upvote 0

Forum statistics

Threads
1,215,944
Messages
6,127,835
Members
449,411
Latest member
adunn_23

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