View Single Post
 
Old 03-20-2024, 03:00 PM
ArviLaanemets ArviLaanemets is offline Windows 8 Office 2016
Expert
 
Join Date: May 2017
Posts: 949
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default

In your example data, Test1 and Test3 have 9 values for Concat, Test2 has 10 values. So the number of values for every TestX can vary? When yes, you have to determine, must be Concat columns filled in order (having empty fields at rightmost columns, or every Concat value must have a specified column it belongs into.

In my example (have to make it in written form, as I have not Excel available currently), I assume the 1st possibility.

I assume, your table headers are in cells A1 and B1.

1.
Into cell C1 enter a header for new column, e.g. TableRow;
Into Cell C2 enter the formula
=ROW()-1
and copy it down to bottom of table;

2.
Define the datarange of Index (from A2 down until bottom of table) as named range (e.g nIndex);
Define the datarange of Concat column as named renge (e.g. nConcat);
Define the datarange of TableRow column as named range (e.g. nTableRow).

3.
Into cell D1 enter a header for new column, e.g. TestRow;
Into cell D2, enter the formula
=COUNTIFS(nIndex, $A2,nTableRow, "<=" & $C2)
and copy it down to bottom of table. You get all different concat values for every Index value numbered.

4.
Define the datarange of TestRow column as named range (e.g. nTestRow).

5. On another sheet, create a table (NB! A regular table, not a Defined one) with header A1="Index", and into next columns enter numbers 1, 2, ... (at least as many Concat columns as was the biggest number of rows for any index value in 1st table);
In 2nd table, fill the column Index with unique Index values from 1st table;
Into cell B2 of 2nd table, enter the formula
Code:
=IF(SUMIFS(nTableRow,nIndex,$A2,nConcat, B$1)=0,"",INDEX(nConcat,SUMIFS(nTableRow,nIndex,$A2,nConcat, B$1)))
and copy this formula to all cells of datarange of all columns with numbers as headers.

In case you want the new table to have normal headers instead of numbers:
Replace all formulas with their values (PastSpecial>Values);
Overwrite headers.
Reply With Quote