Unique list using Lookup, Countif, need one additional criteria

jcooooper

Board Regular
Joined
Mar 24, 2018
Messages
74
Office Version
  1. 365
Platform
  1. Windows
Hello all,

I stumbled across a wonderful formula which works perfect, but the logic is beyond my comprehension, so I'm having difficulty adding one bit of additional criteria.

In column H, I have a list of text strings, some of which are repeated

Code:
=IFERROR(LOOKUP(2,1/(COUNTIF($AA$2:AA3,$H$3:$H$34)=0),$H$3:$H$34),"")

The above creates a unique list from the list in column H. I drag this formula down and works fine...

What I need is it to exclude this name from the list if the corresponding value in column I is 0.

I tried this:

Code:
=IFERROR(LOOKUP(2,1/(COUNTIFS($AA$2:AA2,$H$3:$H$34,I4,"<>0")=0),$H$3:$H$34),"")

To no avail. The first name in the list pops up but then the rest start returning blanks.

Any help would be greatly appreciated :)

Thanks,
JC
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
try this array formula, confirm with shift-control-return together

=IFERROR(LOOKUP(2,1/(COUNTIF($AA$2:AA3,IF($I$3:$I$34<>0,$H$3:$H$34))=0),$H$3:$H$34),"")
 
Upvote 0
Hmm I'm having the same problem... it works for the first entry then when I drag the formula down it blanks out.

I should specify, the formula is entered into cell AA4.... So it references the range above it as you drag it down

AA4 will reference $AA$2:AA3

AA23 will reference $AA$2:AA22
 
Upvote 0
This is the unique list that the formula creates....it references the cells above it and grows dynamically as the forumla is dragged down...

AA4 will reference $AA$2:AA3

AA23 will reference $AA$2:AA22

etc etc
 
Upvote 0
try this, again an array formula


Book1
HIY
1
2
331
441FALSE
55123
66122
7721
8820
9919
101018
111117
1212114
1313113
1414112
15156
16165
171714
181813
19191
20201
21211
22221
23231
Sheet6
Cell Formulas
RangeFormula
Y4{=IFERROR(LOOKUP(2,1/(COUNTIF($Y$2:Y3,IF($I$3:$I$34<>0,$H$3:$H$34))=0),IF($I$3:$I$34<>0,$H$3:$H$34)),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
try this, again an array formula

HIY
1
2
331
441FALSE
55123
66122
7721
8820
9919
101018
111117
1212114
1313113
1414112
15156
16165
171714
181813
19191
20201
21211
22221
23231

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

Array Formulas
CellFormula
Y4{=IFERROR(LOOKUP(2,1/(COUNTIF($Y$2:Y3,IF($I$3:$I$34<>0,$H$3:$H$34))=0),IF($I$3:$I$34<>0,$H$3:$H$34)),"")}

<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>

Ok this pretty much works..thanks! Only thing though is it is returning a false for those that have a 0..... Is there anyway to avoid the FALSE (can't have a blank either)
 
Upvote 0
i thought you might ask that.

the easiest way is to format the cell font colour as the fill colour, like this


Book1
HIY
1
2
331
441FALSE
55123
66122
7721
8820
9919
101011
111117
12116
131115
141114
15153
1616
17171
18111
19191
20201
21211
22221
23231
Sheet6
 
Last edited:
Upvote 0
Yeah the issue is I am creating another table from this table, and it is dependant on a unique list with no blanks/falses/columns with 0 value as mentioned above....tricky one...I've tried a couple of people at work who are also stumped :confused:
 
Upvote 0
so, what will work in Cell Y4 above for the unique list?
 
Upvote 0

Forum statistics

Threads
1,215,406
Messages
6,124,720
Members
449,184
Latest member
COrmerod

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