I've got a named range called sitelocation
, this it taking data from worksheet sites
column B rows 10 - > 59
In Cell M10 I've added =UNIQUE(sitelocation)
and that has produces the unique values from Column B, but it also contains a 0 entry.
If I make a names range as follows that doesn't contain the 0 entry, but does have duplicates.
=OFFSET(INDIRECT("Sites!$B$10"),0,0,COUNTA(Sites!$B:$B),1)
I've tried wrapping that with UNIQUE, but it errors.
=OFFSET(INDIRECT("Sites!$B$10"),0,0,COUNTA(Sites!$B:$B),1)
Ultimately I want to create a drop down list of unique values from Worksheet Sites B10:B59
, with no 0 entries so I can use it on any worksheet in this workbook.
Can some one help.
Thanks
CodePudding user response:
You can use FILTER inside and then UNIQUE outside:
=UNIQUE(FILTER(sitelocation, sitelocation>0, ""))
Here is a good description of FILTER.
CodePudding user response:
A common formula for producing a unique list (and basing it in M10 as stated):
=IFERROR(INDEX(sitelocation,MATCH(0,COUNTIF($M$9:M9,sitelocation),0)),"")
You can then copy this down and it will list all the unique values (including a 0
if it is in the list). However, you can move the 0
to the top of the list by placing the value 0
in M9 which is then referenced in the unique list formulae. If you take the values from cells M10 downwards, it won't contain 0
as that will always be in M9 so out of the list.
The named range for the list can then be assigned as:
=OFFSET(Sheet1!$M$10,0,0,COUNTIF(Sheet1!$M$10:$M$200,"?*"))