Forum Discussion
Combine Data
Looking for a way to take same ID data and place in 1 row
From this...
| ID | NAME | Teacher | Class | Total |
| 12345 | ESTHER | ARDOIN,R | AVID III | 11 |
| 12345 | ESTHER | SARZYNSKI, | Geometry | 12 |
| 73214 | RACHAEL | SOWELLS,J | Reading I AL | 9 |
| 18834 | CHIEMEZIE | HOLCOMB,H | Health | 13 |
| 18834 | CHIEMEZIE | NESBIT,J | AlgebraII AAC | 13 |
| 18834 | CHIEMEZIE | MCGEE,A | Eng II AAC | 13 |
| 18834 | CHIEMEZIE | LI,M | Chem AAC | 13 |
| 18834 | CHIEMEZIE | LAU,B | Spanish II | 13 |
| 18834 | CHIEMEZIE | MCGEE,T | World HistoryAP | 13 |
| 18834 | CHIEMEZIE | HAASE,P | Soccer 2 YR B | 13 |
| 26997 | RAAKIN | OZMENT,J | US Govt | 9 |
| 26997 | RAAKIN | DAVIS,A | Art I | 9 |
| 26997 | RAAKIN | HERTEL,N | ENG IV D SM2 | 9 |
| 57111 | SHAHD | PULIDO,T | World Geo | 9 |
| 57111 | SHAHD | RIVERA,S | AquaSci | 9 |
| 57111 | SHAHD | PYLES,A | Eng IV | 9 |
| 57111 | SHAHD | THOMAS,A | Chem I | 9 |
| 57111 | SHAHD | ZHU,W | Chinese II | 10 |
| 57111 | SHAHD | OZMENT,J | US Govt | 11 |
| 57111 | SHAHD | LACOUR,J | AlgReason | 11 |
To this...
| ID | NAME | Teacher | Class | Total | Teacher | Class | Total | Teacher | Class | Total | Teacher | Class | Total | Teacher | Class | Total | Teacher | Class | Total | Teacher | Class | Total |
| 12345 | ESTHER | ARDOIN,R | AVID III | 11 | SARZYNSKI, | Geometry | 12 | |||||||||||||||
| 73214 | RACHAEL | SOWELLS,J | Reading I AL | 9 | ||||||||||||||||||
| 18834 | CHIEMEZIE | HOLCOMB,H | Health | 13 | NESBIT | AlgebraII AAC | 13 | MCGEE,A | Eng II AAC | 13 | LI,M | Chem AAC | 13 | LAU,B | Spanish II | 13 | MCGEE,T | World HistoryAP | 13 | HAASE,P | Soccer 2 YR B | 13 |
| 26997 | RAAKIN | OZMENT,J | US Govt | 9 | DAVIS,A | Art I | 9 | HERTEL,N | ENG IV D SM2 | 9 | ||||||||||||
| 57111 | SHAHD | PULIDO,T | World Geo | 9 | RIVERA,S | AquaSci | 9 | PYLES,A | Eng IV | 9 | THOMAS,A | Chem I | 9 | ZHU,W | Chinese II | 10 | OZMENT,J | US Govt | 11 | LACOUR,J | AlgReason | 11 |
The spreadsheet has 778 rows and I would love to find a quicker way to move like data to 1 row so I can do a mail merge
Tamra_Raleylostinexce Based on the sample data provided, and if you're using Excel for MS365, the following dynamic array formula should do the trick:
=LET( head, A1:E1, data, A2:E1000, id, TAKE(data,, 1), fData, FILTER(data, id<>""), students, SORT(UNIQUE(TAKE(fData,, 2))), keyId, TAKE(students,, 1), recordCount, COUNTIF(id, keyId), maxCount, MAX(recordCount), newRows, maxCount-recordCount, pvtHead, HSTACK(TAKE(head,, 2), TOROW(IF(SEQUENCE(maxCount), DROP(head,, 2)))), pvtData, HSTACK(students, WRAPROWS(TOCOL(DROP(SORT(VSTACK(fData, EXPAND(TOCOL(IFS(newRows>=SEQUENCE(, maxCount), keyId), 2),, 5, ""))),, 2)), maxCount*3)), VSTACK(pvtHead, pvtData) )Please see the attached sample workbook...
8 Replies
- djclementsSilver Contributor
Tamra_Raleylostinexce Based on the sample data provided, and if you're using Excel for MS365, the following dynamic array formula should do the trick:
=LET( head, A1:E1, data, A2:E1000, id, TAKE(data,, 1), fData, FILTER(data, id<>""), students, SORT(UNIQUE(TAKE(fData,, 2))), keyId, TAKE(students,, 1), recordCount, COUNTIF(id, keyId), maxCount, MAX(recordCount), newRows, maxCount-recordCount, pvtHead, HSTACK(TAKE(head,, 2), TOROW(IF(SEQUENCE(maxCount), DROP(head,, 2)))), pvtData, HSTACK(students, WRAPROWS(TOCOL(DROP(SORT(VSTACK(fData, EXPAND(TOCOL(IFS(newRows>=SEQUENCE(, maxCount), keyId), 2),, 5, ""))),, 2)), maxCount*3)), VSTACK(pvtHead, pvtData) )Please see the attached sample workbook...
- Tamra_RaleylostinexceCopper Contributor
Hello, you helped me last year with a formula and I’m hoping you can assist again.
You gave me the formula to take same id info and move to 1 row as seen in the first image. Now I’m needing to do the opposite, im needing to go from image 2 and organize like the 1st one - Tamra_RaleylostinexceCopper Contributor
This worked perfect until I realized it last 4 columns didn't show up.
This is an example of what showed up for the student below:
18834 CHIEMEZIE HOLCOMB,H Health 13 NESBIT,J AlgebraII AAC 13 MCGEE,A Eng II AAC 13 LI,M Chem AAC 13 LAU,B Spanish II 13 MCGEE,T World HistoryAP Any ideas on what I did wrong?
- djclementsSilver Contributor
Tamra_Raleylostinexce I was just about to say that I wouldn't know for sure what went wrong without taking a look at your workbook. Glad to hear you figured it out... Cheers! 🙂