如何在第n个单元格中使用Excels COUNTIF,并保留通配符功能 [英] How to use Excels COUNTIF in every nth cell and retain wildcard functionality
问题描述
我一直在网上看每一个网站,每个人都似乎只是建议一个例如 SUMPRODUCT
的替代方案,但是我想使用通配符。通配符可以在 COUNTIF
中正常工作,但不能在其他可见的选项中使用。
I have been looking every where on the net and everyone seems to simply suggest an alternative like SUMPRODUCT
, however, I want to use wildcards. Wildcards work fine in COUNTIF
but not in other alternatives I have seen.
如何在第n个单元格中搜索一个列,并返回一个确切子字符串的次数的计数(即 COUNTIF(range,string)
,其中 范围 ,some string *
,* somestring *
或some?string
)
How can I search every nth cell in a column and return a count of the number of times an exact substring is found (i.e. COUNTIF(range, string)
, where range is every nth cell and string could be "*somestring"
, "some string*"
, "*somestring*"
or "some?string"
)
推荐答案
是, SUMPRODUCT
一个选项 - 说你想要从A2开始的每个第5个单元格(即A2,A7,A12等),你可以使用这个公式计算这些单元格中的text实例(可能在其他文本中)
Yes, SUMPRODUCT
is an option - say you want every 5th cell starting at A2 (i.e. A2, A7, A12 etc.) you can use this formula to count instances of "text" in those cells (possibly within other text)
= SUMPRODUCT((MOD(ROW(A2:A1000)-ROW(A2),5)= 0)+ 0,ISNUMBER(SEARCH(text A1000))+ 0)
将5更改为所需的 n - 始终以第一个如果你使用t,单元格在范围内他的语法
change the 5 to whatever n you want - it always starts with the first cell in the range if you use this syntax.
ISNUMBER(SEARCH
部分给你相当于一个通配符搜索(你可以'在这里使用实际的通配符)
The ISNUMBER(SEARCH
part gives you the equivalent of a "wildcard" search (you can't use actual wildcards here)
更新
如果你想要相当于text *,然后使用LEFT函数,例如
If you want the equivalent of "text*" then use LEFT function, e.g.
= SUMPRODUCT((MOD(ROW(A2:A1000)-ROW(A2),5)= 0)+0, (LEFT(A2:A1000,LEN(text))=text)+ 0)
,RIGHT可用于相当于* text。
and RIGHT can be used for the equivalent of "*text".
如果你想要相当于t?xt,那将会更棘手。第一个公式中的SEARCH函数将允许您搜索t?xt,但这将在其他文本中,因此,如果要将整个内容t?xt添加到另一个检查中,例如
IF you want the equivalent of "t?xt" that would be trickier. The SEARCH function in the first formula will allow you to search for "t?xt" but that would be amongst other text so if you want the entire contents to be "t?xt" you could add another check, e.g.
= SUMPRODUCT((MOD(ROW(A2:A1000)-ROW(A2),5)= 0)+ 0,ISNUMBER(SEARCH xt,A2:A1000))+ 0,(LEN(A2:A1000)= 4)+0)
包含text,toxt,t5xt等而不是text2的单元格
That will only count cells which contain "text", "toxt", "t5xt" etc. but not "text2"
这篇关于如何在第n个单元格中使用Excels COUNTIF,并保留通配符功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!