Hi,
I have a spreadsheet of people who met one or more selected criteria (Col. A), with 1 row for each of their relatives in the database (the relative's data is in columns F through J).
So Becky (rows 2 & 3) met one criteria (CREW) and has 2 relatives, so she has two rows... data repeats in columns A through E, and is different in F through J.
Where we have a problem is when a person meets two or more selected criteria. See Laurence whose rows repeat for DORM and VOLUNTEER, or Silas whose rows repeat for DORM, CREW, and VOLUNTEER.
I would like write a macro that removes rows that have duplicate data in Columns B through J, but capture the text in column A and add it to the text in column A for the remaining row with original values. So instead of Silas having 9 rows (3 for DORM, 3 for CREW, 3 for VOLUNTEER), he will have 3 rows the each have DORM CREW VOLUNTEER in column A.
Below I put my raw data, and my desired results. Also, the macro I created to de-dupe based on col. B-J. Is it possible to add code to the macro that will do what I'm hoping?
Thank you so much as always!
Heather
I have a spreadsheet of people who met one or more selected criteria (Col. A), with 1 row for each of their relatives in the database (the relative's data is in columns F through J).
So Becky (rows 2 & 3) met one criteria (CREW) and has 2 relatives, so she has two rows... data repeats in columns A through E, and is different in F through J.
Where we have a problem is when a person meets two or more selected criteria. See Laurence whose rows repeat for DORM and VOLUNTEER, or Silas whose rows repeat for DORM, CREW, and VOLUNTEER.
I would like write a macro that removes rows that have duplicate data in Columns B through J, but capture the text in column A and add it to the text in column A for the remaining row with original values. So instead of Silas having 9 rows (3 for DORM, 3 for CREW, 3 for VOLUNTEER), he will have 3 rows the each have DORM CREW VOLUNTEER in column A.
Below I put my raw data, and my desired results. Also, the macro I created to de-dupe based on col. B-J. Is it possible to add code to the macro that will do what I'm hoping?
Test Affinity Network RAW DATA.xlsm | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | Affinity | ID# | Name | 5-yr Giving | Jnt LTG | Relation Id | Relation Name | Relation Type | Relation 5-yr Giving | Relation Jnt LTG | ||
2 | CREW | 10019703 | Becky | 825 | 1880 | 10081779 | Spouse/Partner | Jose | 170 | 1880 | ||
3 | CREW | 10019703 | Becky | 825 | 1880 | 10020555 | Parent | Edward | 0 | 25 | ||
4 | DORM | 10025811 | Laurence | 4475 | 7015 | 6406626 | Parent | Richard | 3841.79 | 63486.54 | ||
5 | DORM | 10025811 | Laurence | 4475 | 7015 | 10030236 | Sibling | Juliet | 650 | 1305 | ||
6 | VOLUNTEER | 10025811 | Laurence | 4475 | 7015 | 6406626 | Parent | Richard | 3841.79 | 63486.54 | ||
7 | VOLUNTEER | 10025811 | Laurence | 4475 | 7015 | 10030996 | Parent | Richard | 0 | 63486.54 | ||
8 | DORM | 10025875 | Elizabeth | 600 | 1320 | 10035178 | Sibling | Michael | 600 | 1130 | ||
9 | CREW | 10025875 | Elizabeth | 600 | 1320 | 10035178 | Sibling | Michael | 600 | 1130 | ||
10 | CREW | 10025905 | Holly | 875 | 4129.97 | 6934329 | Parent | Robert | 2080475.91 | 6228633.19 | ||
11 | CREW | 10025905 | Holly | 875 | 4129.97 | 10025740 | Spouse/Partner | Kris | 875 | 4129.97 | ||
12 | CREW | 10025905 | Holly | 875 | 4129.97 | 10018011 | Sibling | Heather | 13500 | 25895 | ||
13 | VOLUNTEER | 10025905 | Holly | 875 | 4129.97 | 6934329 | Parent | Robert | 2080475.91 | 6228633.19 | ||
14 | VOLUNTEER | 10025905 | Holly | 875 | 4129.97 | 10018011 | Sibling | Heather | 13500 | 25895 | ||
15 | VOLUNTEER | 10025905 | Holly | 875 | 4129.97 | 10025740 | Spouse/Partner | Kris | 875 | 4129.97 | ||
16 | DORM | 10025944 | Anne | 750 | 1418 | 10026293 | Parent | Geoff | 500 | 2600 | ||
17 | DORM | 10025944 | Anne | 750 | 1418 | 10037397 | Sibling | Michael | 45.02 | 200.02 | ||
18 | CREW | 10025944 | Anne | 750 | 1418 | 10026293 | Parent | Geoff | 500 | 2600 | ||
19 | CREW | 10025944 | Anne | 750 | 1418 | 10037397 | Sibling | Michael | 45.02 | 200.02 | ||
20 | DORM | 10025966 | Silas | 212.5 | 1710.17 | 10072388 | Parent | Sally | 0 | 46275 | ||
21 | DORM | 10025966 | Silas | 212.5 | 1710.17 | 10086914 | Inlaw | Liana | 0 | 0 | ||
22 | DORM | 10025966 | Silas | 212.5 | 1710.17 | 10020131 | Sibling | Kaimi | 275 | 575 | ||
23 | CREW | 10025966 | Silas | 212.5 | 1710.17 | 10072388 | Parent | Sally | 0 | 46275 | ||
24 | CREW | 10025966 | Silas | 212.5 | 1710.17 | 10086914 | Inlaw | Liana | 0 | 0 | ||
25 | CREW | 10025966 | Silas | 212.5 | 1710.17 | 10020131 | Sibling | Kaimi | 275 | 575 | ||
26 | VOLUNTEER | 10025966 | Silas | 212.5 | 1710.17 | 10072388 | Parent | Sally | 0 | 46275 | ||
27 | VOLUNTEER | 10025966 | Silas | 212.5 | 1710.17 | 10086914 | Inlaw | Liana | 0 | 0 | ||
28 | VOLUNTEER | 10025966 | Silas | 212.5 | 1710.17 | 10020131 | Sibling | Kaimi | 275 | 575 | ||
existing |
Test Affinity Network RAW DATA.xlsm | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | Affinity | ID# | Name | 5-yr Giving | Jnt LTG | Relation Id | Relation Type | Relation Name | Relation 5-yr Giving | Relation Jnt LTG | ||
2 | CREW | 10019703 | Becky | 825 | 1880 | 10081779 | Spouse/Partner | Jose | 170 | 1880 | ||
3 | CREW | 10019703 | Becky | 825 | 1880 | 10020555 | Parent | Edward | 0 | 25 | ||
4 | DORM VOLUNTEER | 10025811 | Laurence | 4475 | 7015 | 6406626 | Parent | Richard | 3841.79 | 63486.54 | ||
5 | DORM VOLUNTEER | 10025811 | Laurence | 4475 | 7015 | 10030236 | Sibling | Juliet | 650 | 1305 | ||
6 | DORM CREW | 10025875 | Elizabeth | 600 | 1320 | 10035178 | Sibling | Michael | 600 | 1130 | ||
7 | CREW VOLUNTEER | 10025905 | Holly | 875 | 4129.97 | 6934329 | Parent | Robert | 2080475.91 | 6228633.19 | ||
8 | CREW VOLUNTEER | 10025905 | Holly | 875 | 4129.97 | 10025740 | Spouse/Partner | Kris | 875 | 4129.97 | ||
9 | CREW VOLUNTEER | 10025905 | Holly | 875 | 4129.97 | 10018011 | Sibling | Heather | 13500 | 25895 | ||
10 | DORM CREW | 10025944 | Anne | 750 | 1418 | 10026293 | Parent | Geoff | 500 | 2600 | ||
11 | DORM CREW | 10025944 | Anne | 750 | 1418 | 10037397 | Sibling | Michael | 45.02 | 200.02 | ||
12 | DORM CREW VOLUNTEER | 10025966 | Silas | 212.5 | 1710.17 | 10072388 | Parent | Sally | 0 | 46275 | ||
13 | DORM CREW VOLUNTEER | 10025966 | Silas | 212.5 | 1710.17 | 10086914 | Inlaw | Liana | 0 | 0 | ||
14 | DORM CREW VOLUNTEER | 10025966 | Silas | 212.5 | 1710.17 | 10020131 | Sibling | Kaimi | 275 | 575 | ||
result |
VBA Code:
Sub Dedupe()
'
' Dedupe Macro
' remove rows with dupe values in B through J
'
'
ActiveSheet.Range("$A$1:$AW$454").RemoveDuplicates Columns:=Array(2, 3, 4, 5, 6, 7 _
, 8, 9, 10), Header:=xlYes
End Sub
Thank you so much as always!
Heather