Good evening!
I am working on combining several rows of data with similar ID numbers. I have a small example below. For reference, my data set is every possible combination of an origin/destination for the contiguous US, so 2,401 rows total. Also, I will need to do this several times in the future with different ID numbers, so a general solution would be most helpful.
Essentially, I need to combine states with similar ID numbers into something more useful based on similarities in ID number and groups for State 2. For example, the ID numbers starting at 24 have a repeating MT, ND, WY in State 2. So I would like some sort of output like this:
AL, AR, AZ CA in one cell.
MT, ND, WY in another cell.
Since each of AL, AR, AZ, CA, each are matched with MT, ND, and WY and also with the same ID number.
Is this something that can be done? I appreciate any help you can offer.
Thank you!
ID State 1 State 2
15 NC NC
15 WI KS
16 FL FL
17 UT CO
18 NM NM
19 RI KS
20 CA AZ
21 UT ID
22 CA NV
23 MO KS
24 AL MT
24 AL ND
24 AL WY
24 AR MT
24 AR ND
24 AR WY
24 AZ MT
24 AZ ND
24 AZ WY
24 CA MT
24 CA ND
24 CA WY
I am working on combining several rows of data with similar ID numbers. I have a small example below. For reference, my data set is every possible combination of an origin/destination for the contiguous US, so 2,401 rows total. Also, I will need to do this several times in the future with different ID numbers, so a general solution would be most helpful.
Essentially, I need to combine states with similar ID numbers into something more useful based on similarities in ID number and groups for State 2. For example, the ID numbers starting at 24 have a repeating MT, ND, WY in State 2. So I would like some sort of output like this:
AL, AR, AZ CA in one cell.
MT, ND, WY in another cell.
Since each of AL, AR, AZ, CA, each are matched with MT, ND, and WY and also with the same ID number.
Is this something that can be done? I appreciate any help you can offer.
Thank you!
ID State 1 State 2
15 NC NC
15 WI KS
16 FL FL
17 UT CO
18 NM NM
19 RI KS
20 CA AZ
21 UT ID
22 CA NV
23 MO KS
24 AL MT
24 AL ND
24 AL WY
24 AR MT
24 AR ND
24 AR WY
24 AZ MT
24 AZ ND
24 AZ WY
24 CA MT
24 CA ND
24 CA WY