【问题标题】:Identify all permutations of a four-digit number识别一个四位数的所有排列
【发布时间】:2013-05-01 17:08:23
【问题描述】:

我如何或什么是公式,让 Excel 识别工作表中序列中具有相同四位数字的所有相同数字。例如1234, 4321, 2143 ?

有一百个数字,但如果1234 在工作表上以任何顺序一起出现,我希望它突出显示或类似。

【问题讨论】:

  • 总是 1 2 3 4 您正在搜索的数字?

标签: excel excel-formula combinations vlookup conditional-formatting


【解决方案1】:

完全在公式中执行此操作(不使用 VBA)的唯一方法是蛮力搜索。如果数字 1、2、3、4 在单元格 A1 中以任意顺序出现,则以下公式将返回 TRUE。要突出显示符合条件的单元格,请将其用作条件格式规则的输入(在 Excel 2007 或 2010 中,查找名为“使用公式确定要格式化的单元格”的规则类型)。

=NOT(AND(ISERR(SEARCH("1234",TEXT(A1,"#"))),ISERR(SEARCH("1243",TEXT(A1,"#"))),ISERR(SEARCH("1324",TEXT(A1,"#"))),ISERR(SEARCH("1342",TEXT(A1,"#"))),ISERR(SEARCH("1423",TEXT(A1,"#"))),ISERR(SEARCH("1432",TEXT(A1,"#"))),ISERR(SEARCH("2134",TEXT(A1,"#"))),ISERR(SEARCH("2143",TEXT(A1,"#"))),ISERR(SEARCH("2314",TEXT(A1,"#"))),ISERR(SEARCH("2341",TEXT(A1,"#"))),ISERR(SEARCH("2413",TEXT(A1,"#"))),ISERR(SEARCH("2431",TEXT(A1,"#"))),ISERR(SEARCH("3124",TEXT(A1,"#"))),ISERR(SEARCH("3142",TEXT(A1,"#"))),ISERR(SEARCH("3214",TEXT(A1,"#"))),ISERR(SEARCH("3241",TEXT(A1,"#"))),ISERR(SEARCH("3412",TEXT(A1,"#"))),ISERR(SEARCH("3421",TEXT(A1,"#"))),ISERR(SEARCH("4123",TEXT(A1,"#"))),ISERR(SEARCH("4132",TEXT(A1,"#"))),ISERR(SEARCH("4213",TEXT(A1,"#"))),ISERR(SEARCH("4231",TEXT(A1,"#"))),ISERR(SEARCH("4312",TEXT(A1,"#"))),ISERR(SEARCH("4321",TEXT(A1,"#")))))

【讨论】:

    【解决方案2】:

    以下内容比@dodgethesteamroller 的回答更短(不足为奇!):

    =IFERROR(VLOOKUP(D1,$A:$A,1,0),"")=D1

    Applies to 的适当范围但仅适用于四位数字,而不是说 34451234,并假设所有可能的排列(四位数字为 24)分别列在 A 列中。

    选择您希望识别四位数字集的范围(假定为 D 列)和 HOME > 样式 - 条件格式,新规则...,使用公式确定要格式化的单元格 和 Format values where this formula is true: 添加上面的公式和 Format...,选择您选择的格式,OK,OK。

    【讨论】:

      猜你喜欢
      • 2016-02-09
      • 2018-03-16
      • 2012-11-30
      • 1970-01-01
      • 2019-10-31
      • 1970-01-01
      • 2014-03-31
      • 1970-01-01
      • 2014-02-27
      相关资源
      最近更新 更多