You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hello Community!
I would like to take the following information:
Header 1 | Header 2 | Header 3 |
Fruit | Letter A | Apple |
Fruit | Letter A | Apricot |
Fruit | Letter B | Banana |
Fruit | Letter B | Blueberry |
Fruit | Letter C | Cherry |
And transform it into the following:
*Updated 6-May-2021 - Original post unable to process merged cells. Removed original content and replaced with image of desired output.
Thank you for your insight!
Emily
Hello Emily,
Here is the SQL:
SELECT T1.'Header 1', T1.'Header 2',
FORMATWIKI(SUM(T1.'Header 3' + "\n")) AS 'Header 3'
FROM T1
GROUP BY T1.'Header 1', T1.'Header 2'
And the result:
Or you can use the Pivot Table macro (it is also shipped with the Table Filter and Charts app):
Don't forget to hide totals:
Is there a way to use SQL but have each item after the merged column appear in it's own row with a border still around it? I know the "\n" creates a line break, but it is still making my table very messy. I would prefer them to have their own row.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Madison Small ,
The Table Transformer macro sees the source table as a mini SQL database, so it can merge cells into one big cell by joining their contents. If we leave a border, then they will be counted as two separate cells and you won't get an aggregated table at all.
Maybe it will be easier to read your table when using ", " instead of the "\n": you'll get "Apple, Apricot" as a result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Katerina Kovriga _Stiltsoft_ How would you do something like this with labels? When I try to merge cells that container labels, then labels are turned into plain strings and lose their formatting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to use the Pivot Table macro instead of the Table Transformer - the initial formatting of the merged data will be preserved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe this is not as similar as I thought. So I would like to keep the formatting of my result table which would be a vertical header column with the data in a column to the right of the headers. I am merging 4 tables together and need to get just the column that contains labels to merge together. Unfortunately, the pivot table manipulates the result table too much and also does a lot of header renaming.
Desired Result:
header 1 | data
header 2 | Label1, label2, label 3, etc (These can be on newlines too)
Originals:
Table 1
header 1 | header 2
--------- ---------
Data. label 1, label 2
Table 2
header 1 | header 2
--------- ---------
Data. label, 2, label 3
etc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you merge labels into one cell, then the Table Transformer macro may lose the original formatting because it is a new cell with simple text strings for it.
We have similar ticket in our backlog and added your vote to it, when the feature is implemented, we'll get back to the thread.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Megan ,
You may use the Pivot Table macro as for now.
If necessary, you may wrap the Pivot Table macro in the Table Transformer macro on top and rename the required columns.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When I add the table transformer on top, it unmerges the cells. Is there a way to keep the merge?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, no.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.