I would like an Excel formula that will help me split entries in a single row to be split into multiple rows as shown in the second table in the image.
Would appreciate any help:
Attempted the formulas shared in How do I split one row into multiple rows with Excel? however it doesn't work if Name column entries are duplicated.
=IF(COUNTIF($A$7:A7,A7)=COUNTA(OFFSET('Sheet2'!$B$1:$D$1,MATCH(A7,'Sheet2'!$A$2:$A,0),0)),INDEX('Sheet2'$A$2:$A,MATCH(A7,'Sheet2'$A$2:$A,0)+1),A7)
Best Answer
To transform your
Table1
toTable2
, as in your first screen shot, you can usePower Query
available in Excel 2010+ either as a free add-in from MS, or built-in in later versions.Although the transformation can be done from the GUI, that will return errors if you expand the number of columns in your data. So you need to modify the actual M-Code that is generated.
Task Name | Start Time | End Time | Consumed Time
).Consumed Time
column contains formatted Integers. If it really contains text, some changes will be required in the Query.Steps:
PQ
will turn a range into a Table, or you can do this yourself)Project Name
and unpivot other columnsAttribute
columnInteger/Divide
column dividing by 4Integer-Division
andProject Name
columns withOperation:= All Rows
(no aggregation)Project Name
andTask Name
This query can be refreshed if you change anything, or add rows or column groups.
If you just paste the code into the Advanced Editor of a blank query, you will need to change
Table3
in line 2 to whatever the name of your table is on your worksheet.M-Code