英文:
Countif data does not equal any number in a range
问题
我正在处理一个 Google 表格,我在其中输入邮政编码信息。列 A 将包含从调查受访者那里收到的邮政编码。
列 B、C、D 和 E 包括不同地区的邮政编码参考列表。我需要知道有多少受访者住在每组邮政编码中,因此我正在使用以下公式来统计:
=sumproduct(countif(A2:A1000,B2:B1000))
我正在寻找一个公式来捕获输入到列 A 中的任何数字,这些数字与列 B、C、D 和 E 中的任何参考邮政编码都不匹配。
我尝试过以下公式:
=sumproduct(countif(A2:A1000,<>B2:B1000))
但是出现了公式解析错误。
我看到的大多数示例都使用非常小的数据集,因此它们使用类似于 =sumproduct(countif(A2:A1000,<> "DATA"))
的公式,但我正在处理大型数据范围,所以这对我来说并不特别有帮助。
我看到的一些其他类似的示例都建议使用比我熟悉的更复杂的公式,所以我无法分辨哪些对我有用。
编辑:示例数据
A 列 | 区域 B | 区域 C | 区域 D | 区域 E |
---|---|---|---|---|
78040 | 72744 | 90806 | 55975 | 73098 |
71369 | 65501 | 26743 | 56051 | 79022 |
13375 | 85739 | 40830 | 18640 | 51461 |
24312 | 45333 | 54554 | 35211 | 54821 |
44089 | 84656 | 50612 | 31326 | 95471 |
70762 | 17087 | 25387 | 24312 | 30650 |
73098 | 50611 | 60435 | 77612 | 49712 |
79022 | 8316 | 28204 | 51245 | 97450 |
37668 | 75495 | 46381 | 94539 | 72014 |
43021 | 21056 | 32212 | 57249 | 26542 |
84656 | 43152 | 26691 | 38345 | 30116 |
44188 | 29848 | 27966 | 71369 | 95683 |
25387 | 17881 | 99701 | 62474 | 53593 |
85974 | 98565 | 72088 | 22835 | 40517 |
50247 | 35572 | 34472 | 45732 | 99753 |
94279 | 20765 | 4463 | 32828 | 85718 |
56332 | 99031 | 45415 | 97520 | 41512 |
55303 | 43446 | 37803 | 94102 | 75803 |
81229 | 42061 | 95960 | 42036 | 98376 |
18640 | 15142 | 72031 | 39114 | 97026 |
53593 | 26448 | 23486 | 12915 | 7017 |
72785 | 6256 | 68661 | 19137 | 15696 |
46381 | 97753 | 17052 | 17880 | 93106 |
40517 | 83011 | 46710 | 52165 | 79539 |
51245 | 24566 | 56332 | 88116 | 15325 |
22162 | ||||
24566 | ||||
89041 |
非常感谢。
英文:
I'm working on a Google Sheet where I am entering zipcode information. Column A will have zip codes received from survey respondents.
Columns B, C, D and E include reference lists of zipcodes in different areas. I need to know how many respondents live in each group of zipcodes, so I'm using this formula to tally that:
=sumproduct(countif(A2:A1000,B2:B1000))
I'm looking for a formula to capture any number entered in Column A that doesn't match any of my reference zip codes in columns B, C, D and E.
I've tried:
=sumproduct(countif(A2:A1000,<>B2:B1000))
and am getting a formula parse error.
Most of the examples I'm seeing are using really small datasets, so they're using a formula like =sumproduct(countif(A2:A1000,<>"DATA"))
, but I am working with large data ranges, so that's not particularly helpful.
Some other examples I've seen that seem similar are being recommended formulas that are more complex than what I'm familiar with, so I'm not able to pick apart what might be useful to me.
Edit: Sample data
A Column | Area B | Area C | Area D | Area E |
---|---|---|---|---|
78040 | 72744 | 90806 | 55975 | 73098 |
71369 | 65501 | 26743 | 56051 | 79022 |
13375 | 85739 | 40830 | 18640 | 51461 |
24312 | 45333 | 54554 | 35211 | 54821 |
44089 | 84656 | 50612 | 31326 | 95471 |
70762 | 17087 | 25387 | 24312 | 30650 |
73098 | 50611 | 60435 | 77612 | 49712 |
79022 | 8316 | 28204 | 51245 | 97450 |
37668 | 75495 | 46381 | 94539 | 72014 |
43021 | 21056 | 32212 | 57249 | 26542 |
84656 | 43152 | 26691 | 38345 | 30116 |
44188 | 29848 | 27966 | 71369 | 95683 |
25387 | 17881 | 99701 | 62474 | 53593 |
85974 | 98565 | 72088 | 22835 | 40517 |
50247 | 35572 | 34472 | 45732 | 99753 |
94279 | 20765 | 4463 | 32828 | 85718 |
56332 | 99031 | 45415 | 97520 | 41512 |
55303 | 43446 | 37803 | 94102 | 75803 |
81229 | 42061 | 95960 | 42036 | 98376 |
18640 | 15142 | 72031 | 39114 | 97026 |
53593 | 26448 | 23486 | 12915 | 7017 |
72785 | 6256 | 68661 | 19137 | 15696 |
46381 | 97753 | 17052 | 17880 | 93106 |
40517 | 83011 | 46710 | 52165 | 79539 |
51245 | 24566 | 56332 | 88116 | 15325 |
22162 | ||||
24566 | ||||
89041 |
Many thanks.
答案1
得分: 1
我为您创建了一个示例数据<br>
请尝试这个公式
=IFERROR(FILTER(A2:A, ISERROR(MATCH(A2:A, TOCOL(UNIQUE(B2:E)) , FALSE))), "No Match")
解释:
这个公式用于基于列B到E中是否存在匹配来筛选列A中的一系列值。让我们逐步分解这个公式:
-
UNIQUE(B2:E)
从列B到E返回一列唯一值的列表。它通过垂直堆叠这些列的值来创建一个唯一值的单列。 -
TOCOL(UNIQUE(B2:E))
将唯一值的列转置为一行。这一步是必要的,因为MATCH函数使用行向量工作,我们希望将其与列A中的值进行比较。 -
MATCH(A2:A, TOCOL(UNIQUE(B2:E)), FALSE)
比较列A中的每个值(A2:A)与列B到E中的唯一值。它返回匹配值在唯一值列表中的相对位置,如果没有匹配,则返回错误值(#N/A)。 -
ISERROR(MATCH(A2:A, TOCOL(UNIQUE(B2:E)), FALSE))
检查每个列A中的值是否存在错误(没有匹配)。它返回一个包含TRUE和FALSE值的数组,其中TRUE表示没有匹配,FALSE表示有匹配。 -
FILTER(A2:A, ISERROR(MATCH(A2:A, TOCOL(UNIQUE(B2:E)), FALSE)))
基于从前一步获取的TRUE和FALSE值的数组筛选列A中的值。它仅返回列B到E中没有匹配的列A中的值。 -
IFERROR
(FILTER(A2:A, ISERROR(MATCH(A2:A, TOCOL(UNIQUE(B2:E)), FALSE))), "No Match")
将从第5步中筛选出的值包装在IFERROR函数中。如果FILTER函数返回任何值,它们将被显示。否则,如果没有匹配,它会显示文本"No Match"。
根据要求,该公式筛选列A中的值,并仅返回那些在列B到E中没有匹配的值。如果没有匹配,它将显示文本"No Match",您可以将"No Match"替换为""以不返回任何内容。
使用的公式帮助<br>
IFERROR
- FILTER
- ISERROR
- MATCH
- UNIQUE
欢迎来到stackoverflow
英文:
I created a sample data for you<br>
Try this formula
=IFERROR(FILTER(A2:A, ISERROR(MATCH(A2:A,TOCOL(UNIQUE(B2:E)) , FALSE))), "No Match")
Explanation:
This formula is used to filter a range of values in column A based on whether they have a match in columns B to E. Let's break down the formula step by step:
-
UNIQUE(B2:E)
returns a list of unique values from columns B to E. It creates a single column of unique values by stacking the values from those columns vertically. -
TOCOL(UNIQUE(B2:E))
converts the column of unique values into a row by transposing it. This step is necessary because the MATCH function works with row vectors, and we want to compare it with the values in column A. -
MATCH(A2:A, TOCOL(UNIQUE(B2:E)), FALSE)
compares each value in column A (A2:A) with the unique values in columns B to E. It returns the relative position of the matching value in the unique values list or an error value (#N/A) if there's no match. -
ISERROR(MATCH(A2:A, TOCOL(UNIQUE(B2:E)), FALSE))
checks if there is an error (no match) for each value in column A. It returns an array of TRUE and FALSE values, where TRUE indicates no match and FALSE indicates a match. -
FILTER(A2:A, ISERROR(MATCH(A2:A, TOCOL(UNIQUE(B2:E)), FALSE)))
filters the values in column A based on the array of TRUE and FALSE values obtained from the previous step. It returns only the values from column A that do not have a match in columns B to E. -
IFERROR
(FILTER(A2:A, ISERROR(MATCH(A2:A, TOCOL(UNIQUE(B2:E)), FALSE))), "No Match")
wraps the filtered values from step 5 with the IFERROR function. If the FILTER function returns any values, they are displayed. Otherwise, if there are no matches, it displays the text "No Match".
As required, the formula filters the values in column A and returns only those values that do not have a match in columns B to E. If there are no matches, it displays the text "No Match", You can replace "No Match" with "" to return nothing.
Used formulas help<br>
IFERROR
- FILTER
- ISERROR
- MATCH
- UNIQUE
Welcome to stackoverflow
答案2
得分: 1
"Simple COUNTIFS()
should work with FILTER()
function.
=FILTER(A2:A,INDEX(COUNTIFS(B2:E,A2:A))=0)"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论