[英]Excel - Create Dropdown list with unique entries and no 0 entries
I've got a named range called sitelocation
, this it taking data from worksheet sites
column B rows 10 - > 59我有一个名为sitelocation
的命名范围,它从工作表sites
列 B 行 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.在单元格 M10 中,我添加了=UNIQUE(sitelocation)
并从列 B 中生成了唯一值,但它还包含一个 0 条目。
If I make a names range as follows that doesn't contain the 0 entry, but does have duplicates.如果我按如下方式创建不包含 0 条目但有重复项的名称范围。 =OFFSET(INDIRECT("Sites,$B$10"),0,0:COUNTA(Sites,$B:$B),1)
I've tried wrapping that with UNIQUE, but it errors.我试过用 UNIQUE 包装它,但它出错了。 =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.最终,我想从 Worksheet Sites B10:B59
创建一个唯一值的下拉列表,没有 0 个条目,因此我可以在该工作簿中的任何工作表上使用它。
Can some one help.有人可以帮忙吗?
Thanks谢谢
A common formula for producing a unique list (and basing it in M10 as stated):生成唯一列表的常用公式(并按规定将其基于 M10):
=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).然后您可以将其复制下来,它将列出所有唯一值(如果在列表中则包括0
)。 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.但是,您可以通过将值0
放在 M9 中将0
移动到列表的顶部,然后在唯一列表公式中引用该值。 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.如果您从单元格 M10 向下取值,它将不包含0
,因为它始终位于 M9 中,因此不在列表中。
The named range for the list can then be assigned as:然后可以将列表的命名范围分配为:
=OFFSET(Sheet1!$M$10,0,0,COUNTIF(Sheet1!$M$10:$M$200,"?*"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.