Excel:组合半复制记录(具有不同列)?

时间:2016-05-16 16:20:22

标签: excel

如果指定的列相同,我将如何组合记录?

这是我拥有的,以及我正在寻找的结果:

enter image description here

1 个答案:

答案 0 :(得分:1)

如果您不介意它们大而丑,可以使用数组公式完成。这个例子应该做你想要的。如果有重复的条目,它只需要最后定义的值(Prog而不是Kevin Moss的Programmer):

Example Workbook

在C11和D11中输入以下公式,然后按CTRL + SHIFT + ENTER以应用数组公式。然后,您可以根据需要将公式复制到下面的行中。

= INDEX((IF((((($ A11 = $ A $ 2:$ A $ 7)+($ B11 = $ B $ 2:$ B $ 7))= 2)+(C $ 2:C $ 7 LT; > “中”))= 2,C $ 2:C $ 7, “”)),MAX(IF((IF((((($ A11 = $ A $ 2:$ A $ 7)+($ B11 = $ B $ 2 :$ B $ 7))= 2)+(C $ 2:C $ 7 LT;> “中”))= 2,C $ 2:C $ 7, “”))≤;> “中”,ROW($ A $ 1: $ A $ 6),0)))

这打破了一些发生的事情,但不可否认,它仍然非常不透明,对不起:

=INDEX(
       (IF(  # This IF statement collects all entries in a data field for a given Fname/Lname combination
           (((($A11=$A$2:$A$7) + ($B11=$B$2:$B$7))=2) + (C$2:C$7<>""))=2,    # Checks that First and Last Name Match, and Data field isn't empty
           C$2:C$7,      # Return data field if TRUE
           ""            # Return empty if FALSE
          )),
       MAX(  # Take the highest index number, use it to select a row from the result of the IF statement above
           IF((   # This IF statement returns an index number if the data field isn't empty
               IF(  # This IF statement collects all entries in a data field for a given Fname/Lname combination (copied from above)
                  (((($A11=$A$2:$A$7)+($B11=$B$2:$B$7))=2)+(C$2:C$7<>""))=2,
                  C$2:C$7,
                  "")
              )<>"",           # End of conditional statement
              ROW($A$1:$A$6),  # Value if TRUE (ROW used as an incrementing counter)
              0                # Value if FALSE (0 will be ignored in the MAX function that uses this result)
             )
          )
      )