【问题标题】:search in data array and return matching data在数据数组中搜索并返回匹配的数据
【发布时间】:2021-09-12 21:43:10
【问题描述】:

我有 100 行数据,例如:

Led smart TV Noblex 32 '' HD DM32X7000 Android TV
Led smart Philips 32 '' HD 32PHD6825 / 77

我需要在其他列中提取每个数据,“品牌”、“型号”、“产品”。 我想到用数据矩阵来做这件事,例如。

Brand Table: "Phillips", "Noblex", etc (and all other brands)
Table Model: "MD32X7000", "PHD6825 / 77", etc. (and all other models)

而且我需要一个或多个函数来搜索单元格内的数据数组并提取,例如它是否包含“Phiplips”或“Noblex”。 我设法使用带有过滤器“包含”的语句对 VBA 做一些事情:

ActiveSheet.Range("$A$5:$M$700").AutoFilter 3, Array("=*Noblex*"), xlFilterValues
Range("C600").Select
Selection.Offset(0, 9).Select
Range(Selection, Selection.End(xlUp)).Select
Range(Selection, Selection.End(xlUp)).Select
ActiveCell.FormulaR1C1 = "Noblex"

Selection. FillDown

但我需要它与数据矩阵一起使用,因为某些品牌和产品可能会有所不同,并且每次都输入 VBA 来更改参数非常烦人。

这可能吗?还是有其他方法?

非常感谢

【问题讨论】:

    标签: excel vba windows excel-2010 excel-2007


    【解决方案1】:

    您可以为此使用 unique 和 countif 函数。 假设您要过滤的来源在 B 列:

    =TRANSPOSE(UNIQUE(B:B))
    

    如果您不需要连续的结果,请删除转置。

    计算出现次数,假设要搜索的字符串在 F1 中:

    =COUNTIF(B:B;F1)
    

    【讨论】:

      猜你喜欢
      • 2018-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-29
      • 2022-01-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多