List return

vgresia

New Member
Joined
May 31, 2018
Messages
21
Hi there - I am looking to create a dynamic list of unique ID numbers for items matching "Horse" in column J, "Ball" in column I, and that do not contain the word dog in column A. In the example below, this would return the ID numbers 48 and 56. However, the formula would be entered into Sheet 1, while the data is housed on Sheet 2.

ACIJ
PetId NumberToyAnimal
Dog12BallHorse
Doggy56ChewCow
Cat89BallPig
Bird48BallHorse
Doggy95BallCow
Doggy89ChewHorse
Cat56BallHorse
Bird56BallHorse

<tbody>
</tbody>

 

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.
Hi,

For which reason is ... 12 ... excluded ...?
 
Upvote 0
Perhaps:

ABCD
1A Exclude valuedogID numbers
2I IncludeBall48
3J includehorse56
4

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Array Formulas
CellFormula
C2{=IFERROR(INDEX(Sheet2!$C$2:$C$20,SMALL(IF(ISERROR(SEARCH($B$1,Sheet2!$A$2:$A$20))*ISNUMBER(SEARCH($B$2,Sheet2!$I$2:$I$20))*ISNUMBER(SEARCH($B$3,Sheet2!$J$2:$J$20))*(COUNTIF($C$1:$C1,Sheet2!$C$2:$C$20)=0),ROW(Sheet2!$A$2:$A$20)-ROW(Sheet2!$A$2)+1),ROWS($C$2:$C2))),"")}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



I suspect this can be improved, I'll look a bit more at it, and maybe someone else can jump in.
 
Upvote 0
Ah I spoke a little too soon! It is working for listing the first value, when I drag the formula down though it is not recognizing the second ID number. Any thoughts?
 
Upvote 0
Are you aware that this is an array formula? To use an array formula, enter it in the formula bar, then hold down the Control and Shift keys, then press enter. If you've already entered it into the cell, select the cell, press F2, then hold down Control and Shift and press enter. Now you can drag it down.

If it still doesn't work, let me know and I'll see what else it could be.
 
Last edited:
Upvote 0
Yes, I am entering it as an array and using ctrl+shift+enter for the cell and then pulling it down. It is working for the first value but the other values are coming up blank. In your formula should the cell in the second row be (just $C1 changes to $C2 and $C2 changes to $C3):
{=IFERROR(INDEX(Sheet2!$C$2:$C$20,SMALL(IF(ISERROR(SEARCH($B$1,Sheet2!$A$2:$A$20))*ISNUMBER(SEARCH($B$2,Sheet2!$I$2:$I$20))*ISNUMBER(SEARCH($B$3,Sheet2!$J$2:$J$20))*(COUNTIF($C$1:$C2,Sheet2!$C$2:$C$20)=0),ROW(Sheet2!$A$2:$A$20)-ROW(Sheet2!$A$2)+1),ROWS($C$2:$C3))),"")}
 
Upvote 0
Nuts!!

I wrote a whole long explanation of how the formula works, only to realize that I had a bug in it! :oops:

Here's what the C2 formula should be (with CSE):

=IFERROR(INDEX(Sheet2!$C$2:$C$20,SMALL(IF(ISERROR(SEARCH($B$1,Sheet2!$A$2:$A$20))*ISNUMBER(SEARCH($B$2,Sheet2!$I$2:$I$20))*ISNUMBER(SEARCH($B$3,Sheet2!$J$2:$J$20))*(COUNTIF($C$1:$C1,Sheet2!$C$2:$C$20)=0),ROW(Sheet2!$A$2:$A$20)-ROW(Sheet2!$A$2)+1),1)),"")

The $C$1:$C1 range in the COUNTIF is correct, make sure it refers to the cell above the cell where you put the formula. Let me know if this works any better.
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

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