开发者

excel macros- mergine info on diff rows based on ID

开发者 https://www.devze.com 2023-03-14 19:34 出处:网络
Can someone help me go through the steps of creating a macro that merges row with the sam开发者_开发技巧e ID but with different info? This is an example:

Can someone help me go through the steps of creating a macro that merges row with the sam开发者_开发技巧e ID but with different info? This is an example:

ID | info1 | info2 | info3 | info4
1  | T     | F     | F     | F
1  | F     | T     | F     | F
1  | F     | F     | F     | T
2  | T     | F     | F     | F
2  | F     | F     | T     | F

so this would ouptut:

ID | info1 | info2 | info3 | info4
1  | T     | T     | F     | T
2  | T     | F     | T     | F


Non-VBA solution, just in case.

  1. Create list of unique ids. For this example, id list is in Column H, with first entry in H2.
  2. Enter this formula in I2, info1 value for ID 1:

    =IF(SUM(IF($A$2:$A$6=$H2,IF(B$2:B$6="T",1,0),0))=0,"F","T")

  3. Adjust row numbers and columns to match your data.

  4. Press Ctrl+Shift+Enter to enter the formula as an array formula. The formula will show up in {...}.

  5. Fill I2 down to cover each unique id. Fill to the right to cover each info column.

0

精彩评论

暂无评论...
验证码 换一张
取 消