I have the following data set and I am trying to convert from a long to wide format like what is shown in the desired results. Idea is that every two rows with a value in the name column followed immediately after with a row that is blank in the name column belongs to the same group. Another criteria is that the ID is only one off of the other. For example ID 8 is not included in the final results, because it does not belong to the group with ID 3 and 4 because the difference between 3 and 8 is greater than 1.
Thanks in advance!
Sample:
ID | name | text |
1 | Bobby Bob | abc |
2 | cdf | |
3 | Robby Rob | ert |
4 | azx | |
8 | zxc | |
50 | Tracy Smith | xvg |
51 | hve |
Desired result (only the first 3 columns matters, the ID columns are for demonstration purposes):
Name | text | text1 | ID | ID2 |
Bobby Bob | abc | cdf | 1 | 2 |
Robby Rob | ert | azx | 3 | 4 |
Tracy Smith | xvg | hve | 50 | 51 |
Solved! Go to Solution.