Stacking date from a dynamic table

MCreighton

New Member
Joined
Aug 30, 2022
Messages
10
Office Version
  1. 365
Platform
  1. MacOS
I have a dynamic table populated from a variety of sources which is essentially structured as:
dates as column headers (dynamical expands as new dates are entered, object names as left-most column (these names are currently fixed but more may be added), and then numeric data showing how many objects for each date (includes blanks).

I need to be able to stack this data so it can be exported into an external web-site. The stack would need three columns:
The date taken from the existing table column headers, the name of the object, the number of objects on that date.
And it should only stack data where the number of objects is not blank for the date in question.

I understand the basic concepts of stacking but taking successive dates from the existing table column headers to use them as 'row headers' is beyond me at the moment.

Hopefully I've explained the problem properly, but I've attached an image to. give an idea of what I mean. Any help gratefully received.

Mike
 

Attachments

  • Book1.jpg
    Book1.jpg
    221.6 KB · Views: 14
I have a table (mini-sheet sample attached) comprising the records of the number of birds, by species, seen on specific days. Currently this shows the date as column headers with the bird species as row headers (actually two row headers - British Common Name and Scientific Name). In order to import this data into an external web-site I need to create a single list, in date order, showing just four columns: Date; British Common Name; Scientific Name; Number. I would like to ignore 0 numbers in the list, but I can filter those manually if that makes life easier.

Any help or pointers gratefully received.

Many thanks
Mike

Book2
ABCDEFGHIJKLMNOPQRSTUVWXY
1COMBINED ALL TRANSACTS British CommonScientific02/10/1908/10/1916/10/1922/10/1929/10/1903/11/1907/11/1914/11/1920/11/1927/11/1904/12/1911/12/1918/12/1901/01/2008/01/2015/01/2022/01/2029/01/2005/02/2012/02/2019/02/2026/02/2004/03/20
2Brent GooseBranta bernicla81--140--320044-43-1142-52772102--
3Dark-bellied Brent GooseBranta bernicla bernicla-----------------------
4Pale-bellied Brent GooseBranta bernicla hrota-----------------------
5Black BrantBranta bernicla nigricans-----------------------
6Red-breasted GooseBranta ruficollis-----------------------
7Canada GooseBranta canadensis25-360-20----2-12-----52-7-8
8Barnacle GooseBranta leucopsis-----------------------
9Cackling GooseBranta hutchinsii-----------------------
10Snow GooseAnser caerulescens-----------------------
11Greylag GooseAnser anser-----------------------
12Taiga Bean GooseAnser fabalis-----------------------
13Pink-footed GooseAnser brachyrhynchus-----------------------
14Tundra Bean GooseAnser serrirostris-----------------------
15European White-fronted GooseAnser albifrons-----------------------
16Greenland White-fronted GooseAnser albifrons flavirostris-----------------------
17Lesser White-fronted GooseAnser erythropus-----------------------
18Mute SwanCygnus olor2--1-------------------
19Bewick's SwanCygnus columbianus-----------------------
20Whooper SwanCygnus cygnus-----------------------
21Egyptian GooseAlopochen aegyptiaca-----------------------
22ShelduckTadorna tadorna-----------2-621-3214412
23Ruddy ShelduckTadorna ferruginea-----------------------
24Mandarin DuckAix galericulata-----------------------
25Baikal TealSibirionetta formosa-----------------------
26GarganeySpatula querquedula-----------------------
27Blue-winged TealSpatula discors-----------------------
28ShovelerSpatula clypeata-----------------------
29GadwallMareca strepera-4-2-2--343--1---------11
30Falcated DuckMareca falcata-----------------------
31WigeonMareca penelope------------------110---
32American WigeonMareca americana-----------------------
33MallardAnas platyrhynchos614-4185-39218282133377---3
34Black DuckAnas rubripes-----------------------
35PintailAnas acuta-----------------------
36TealAnas crecca237-16--19-315-925111-20121210-47
Sheet1
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Please do not start a new thread for this question. Just post the data here.
Sorry too late - I thought the dynamic table stuff was just confusing matters so thought it would be easier to start again. My mistake.
 
Upvote 0
Never too late ;)

How about
Fluff.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXY
1COMBINED ALL TRANSACTS British CommonScientific02/10/201908/10/201916/10/201922/10/201929/10/201903/11/201907/11/201914/11/201920/11/201927/11/201904/12/201911/12/201918/12/201901/01/202008/01/202015/01/202022/01/202029/01/202005/02/202012/02/202019/02/202026/02/202004/03/2020
2Brent GooseBranta bernicla8100140003200440430114205277210200
3Dark-bellied Brent GooseBranta bernicla bernicla00000000000000000000000
4Pale-bellied Brent GooseBranta bernicla hrota00000000000000000000000
5Black BrantBranta bernicla nigricans00000000000000000000000
6Red-breasted GooseBranta ruficollis00000000000000000000000
7Canada GooseBranta canadensis2503600200000201200000520708
8Barnacle GooseBranta leucopsis00000000000000000000000
9Cackling GooseBranta hutchinsii00000000000000000000000
10Snow GooseAnser caerulescens00000000000000000000000
11Greylag GooseAnser anser00000000000000000000000
12Taiga Bean GooseAnser fabalis00000000000000000000000
13Pink-footed GooseAnser brachyrhynchus00000000000000000000000
14Tundra Bean GooseAnser serrirostris00000000000000000000000
15European White-fronted GooseAnser albifrons00000000000000000000000
16Greenland White-fronted GooseAnser albifrons flavirostris00000000000000000000000
17Lesser White-fronted GooseAnser erythropus00000000000000000000000
18Mute SwanCygnus olor20010000000000000000000
19Bewick's SwanCygnus columbianus00000000000000000000000
20Whooper SwanCygnus cygnus00000000000000000000000
21Egyptian GooseAlopochen aegyptiaca00000000000000000000000
22ShelduckTadorna tadorna000000000002062103214412
23Ruddy ShelduckTadorna ferruginea00000000000000000000000
24Mandarin DuckAix galericulata00000000000000000000000
25Baikal TealSibirionetta formosa00000000000000000000000
26GarganeySpatula querquedula00000000000000000000000
27Blue-winged TealSpatula discors00000000000000000000000
28ShovelerSpatula clypeata00000000000000000000000
29GadwallMareca strepera0402020034300100000000011
30Falcated DuckMareca falcata00000000000000000000000
31WigeonMareca penelope000000000000000000110000
32American WigeonMareca americana00000000000000000000000
33MallardAnas platyrhynchos614041850392182821333770003
34Black DuckAnas rubripes00000000000000000000000
35PintailAnas acuta00000000000000000000000
36TealAnas crecca237016001903150925111020121210047
37
38
39
4002/10/2019Brent GooseBranta bernicla81
4102/10/2019Canada GooseBranta canadensis25
4202/10/2019Mute SwanCygnus olor2
4302/10/2019MallardAnas platyrhynchos6
4402/10/2019TealAnas crecca2
4508/10/2019GadwallMareca strepera4
4608/10/2019MallardAnas platyrhynchos14
4708/10/2019TealAnas crecca37
4816/10/2019Canada GooseBranta canadensis360
4922/10/2019Brent GooseBranta bernicla140
5022/10/2019Mute SwanCygnus olor1
5122/10/2019GadwallMareca strepera2
5222/10/2019MallardAnas platyrhynchos4
5322/10/2019TealAnas crecca1
5429/10/2019Canada GooseBranta canadensis20
5529/10/2019MallardAnas platyrhynchos18
5629/10/2019TealAnas crecca6
5703/11/2019GadwallMareca strepera2
5803/11/2019MallardAnas platyrhynchos5
5907/11/2019Brent GooseBranta bernicla3
6014/11/2019Brent GooseBranta bernicla200
6114/11/2019MallardAnas platyrhynchos3
6214/11/2019TealAnas crecca19
6320/11/2019Brent GooseBranta bernicla44
6420/11/2019GadwallMareca strepera34
6520/11/2019MallardAnas platyrhynchos9
6627/11/2019Canada GooseBranta canadensis2
6727/11/2019GadwallMareca strepera3
6827/11/2019MallardAnas platyrhynchos21
6927/11/2019TealAnas crecca3
7004/12/2019Brent GooseBranta bernicla43
7104/12/2019MallardAnas platyrhynchos8
7204/12/2019TealAnas crecca15
7311/12/2019Canada GooseBranta canadensis12
7411/12/2019ShelduckTadorna tadorna2
7511/12/2019MallardAnas platyrhynchos2
7618/12/2019Brent GooseBranta bernicla11
7718/12/2019GadwallMareca strepera1
7818/12/2019MallardAnas platyrhynchos8
7918/12/2019TealAnas crecca9
8001/01/2020Brent GooseBranta bernicla42
8101/01/2020ShelduckTadorna tadorna6
8201/01/2020MallardAnas platyrhynchos2
8301/01/2020TealAnas crecca25
8408/01/2020ShelduckTadorna tadorna2
8508/01/2020MallardAnas platyrhynchos13
8608/01/2020TealAnas crecca11
8715/01/2020Brent GooseBranta bernicla5
8815/01/2020ShelduckTadorna tadorna1
8915/01/2020MallardAnas platyrhynchos3
9015/01/2020TealAnas crecca1
9122/01/2020Brent GooseBranta bernicla2
9222/01/2020MallardAnas platyrhynchos3
9329/01/2020Brent GooseBranta bernicla7
9429/01/2020Canada GooseBranta canadensis5
9529/01/2020ShelduckTadorna tadorna3
9629/01/2020MallardAnas platyrhynchos7
9729/01/2020TealAnas crecca20
9805/02/2020Brent GooseBranta bernicla7
9905/02/2020Canada GooseBranta canadensis2
10005/02/2020ShelduckTadorna tadorna2
10105/02/2020WigeonMareca penelope1
10205/02/2020MallardAnas platyrhynchos7
10305/02/2020TealAnas crecca12
10412/02/2020Brent GooseBranta bernicla210
10512/02/2020ShelduckTadorna tadorna1
10612/02/2020WigeonMareca penelope10
10712/02/2020TealAnas crecca12
10819/02/2020Brent GooseBranta bernicla2
10919/02/2020Canada GooseBranta canadensis7
11019/02/2020ShelduckTadorna tadorna4
11119/02/2020TealAnas crecca10
11226/02/2020ShelduckTadorna tadorna4
11304/03/2020Canada GooseBranta canadensis8
11404/03/2020ShelduckTadorna tadorna12
11504/03/2020GadwallMareca strepera11
11604/03/2020MallardAnas platyrhynchos3
11704/03/2020TealAnas crecca47
Data
Cell Formulas
RangeFormula
A40:D117A40=LET(Hdr,C1:Y1,Data,A2:B36,nums,C2:Y36,c,COLUMNS(Hdr),s,SEQUENCE(ROWS(Data)*c,,0),xa,INDEX(Hdr,MOD(s,c)+1),xb,INDEX(Data,INT(s/c)+1,{1,2}),xc,INDEX(nums,INT(s/c)+1,MOD(s,c)+1),SORT(FILTER(CHOOSE({1,2,3,4},xa,INDEX(xb,,1),INDEX(xb,,2),xc),xc>0)))
Dynamic array formulas.
 
Upvote 0
Solution
I would use Power Query for this:
Convert your table to an official table (hit Ctrl t and indicate you have headers).
While in the table, click Data > From Table/Range to open PQ (your table should appear).
Select the 1st two columns (select heading of 1st and hold Ctrl while clicking 2nd heading).
From top menu, click Transform > Unpivot Columns > Unpivot Other Columns (produces a 4-column table).
Rename headings (double click to do so), drag columns to desired positions (drag headings) and then filter out 0's of Number column (using drop down filter arrow in heading).
Finally, Home > Close and Load to load back into workbook.
MrExcel_20220831.xlsx
ABCD
1DateCOMBINED ALL TRANSACTS British CommonScientificNumber
210/2/2019Brent GooseBranta bernicla81
310/22/2019Brent GooseBranta bernicla140
411/7/2019Brent GooseBranta bernicla3
511/14/2019Brent GooseBranta bernicla200
611/20/2019Brent GooseBranta bernicla44
712/4/2019Brent GooseBranta bernicla43
812/18/2019Brent GooseBranta bernicla11
91/1/2020Brent GooseBranta bernicla42
101/15/2020Brent GooseBranta bernicla5
111/22/2020Brent GooseBranta bernicla2
121/29/2020Brent GooseBranta bernicla7
132/5/2020Brent GooseBranta bernicla7
142/12/2020Brent GooseBranta bernicla210
152/19/2020Brent GooseBranta bernicla2
1610/2/2019Canada GooseBranta canadensis25
1710/16/2019Canada GooseBranta canadensis360
1810/29/2019Canada GooseBranta canadensis20
Table1
 
Upvote 0
That is marvellous and works perfectly. I will now have to study it in detail to see what it's doing so I can learn this technique for myself. Many, many thanks.
 
Upvote 0
I would use Power Query for this:
Convert your table to an official table (hit Ctrl t and indicate you have headers).
While in the table, click Data > From Table/Range to open PQ (your table should appear).
Select the 1st two columns (select heading of 1st and hold Ctrl while clicking 2nd heading).
From top menu, click Transform > Unpivot Columns > Unpivot Other Columns (produces a 4-column table).
Rename headings (double click to do so), drag columns to desired positions (drag headings) and then filter out 0's of Number column (using drop down filter arrow in heading).
Finally, Home > Close and Load to load back into workbook.
MrExcel_20220831.xlsx
ABCD
1DateCOMBINED ALL TRANSACTS British CommonScientificNumber
210/2/2019Brent GooseBranta bernicla81
310/22/2019Brent GooseBranta bernicla140
411/7/2019Brent GooseBranta bernicla3
511/14/2019Brent GooseBranta bernicla200
611/20/2019Brent GooseBranta bernicla44
712/4/2019Brent GooseBranta bernicla43
812/18/2019Brent GooseBranta bernicla11
91/1/2020Brent GooseBranta bernicla42
101/15/2020Brent GooseBranta bernicla5
111/22/2020Brent GooseBranta bernicla2
121/29/2020Brent GooseBranta bernicla7
132/5/2020Brent GooseBranta bernicla7
142/12/2020Brent GooseBranta bernicla210
152/19/2020Brent GooseBranta bernicla2
1610/2/2019Canada GooseBranta canadensis25
1710/16/2019Canada GooseBranta canadensis360
1810/29/2019Canada GooseBranta canadensis20
Table1
Thanks - I've not really played with power queries. I'll give it a go.
 
Upvote 0
Never too late ;)

How about
Fluff.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXY
1COMBINED ALL TRANSACTS British CommonScientific02/10/201908/10/201916/10/201922/10/201929/10/201903/11/201907/11/201914/11/201920/11/201927/11/201904/12/201911/12/201918/12/201901/01/202008/01/202015/01/202022/01/202029/01/202005/02/202012/02/202019/02/202026/02/202004/03/2020
2Brent GooseBranta bernicla8100140003200440430114205277210200
3Dark-bellied Brent GooseBranta bernicla bernicla00000000000000000000000
4Pale-bellied Brent GooseBranta bernicla hrota00000000000000000000000
5Black BrantBranta bernicla nigricans00000000000000000000000
6Red-breasted GooseBranta ruficollis00000000000000000000000
7Canada GooseBranta canadensis2503600200000201200000520708
8Barnacle GooseBranta leucopsis00000000000000000000000
9Cackling GooseBranta hutchinsii00000000000000000000000
10Snow GooseAnser caerulescens00000000000000000000000
11Greylag GooseAnser anser00000000000000000000000
12Taiga Bean GooseAnser fabalis00000000000000000000000
13Pink-footed GooseAnser brachyrhynchus00000000000000000000000
14Tundra Bean GooseAnser serrirostris00000000000000000000000
15European White-fronted GooseAnser albifrons00000000000000000000000
16Greenland White-fronted GooseAnser albifrons flavirostris00000000000000000000000
17Lesser White-fronted GooseAnser erythropus00000000000000000000000
18Mute SwanCygnus olor20010000000000000000000
19Bewick's SwanCygnus columbianus00000000000000000000000
20Whooper SwanCygnus cygnus00000000000000000000000
21Egyptian GooseAlopochen aegyptiaca00000000000000000000000
22ShelduckTadorna tadorna000000000002062103214412
23Ruddy ShelduckTadorna ferruginea00000000000000000000000
24Mandarin DuckAix galericulata00000000000000000000000
25Baikal TealSibirionetta formosa00000000000000000000000
26GarganeySpatula querquedula00000000000000000000000
27Blue-winged TealSpatula discors00000000000000000000000
28ShovelerSpatula clypeata00000000000000000000000
29GadwallMareca strepera0402020034300100000000011
30Falcated DuckMareca falcata00000000000000000000000
31WigeonMareca penelope000000000000000000110000
32American WigeonMareca americana00000000000000000000000
33MallardAnas platyrhynchos614041850392182821333770003
34Black DuckAnas rubripes00000000000000000000000
35PintailAnas acuta00000000000000000000000
36TealAnas crecca237016001903150925111020121210047
37
38
39
4002/10/2019Brent GooseBranta bernicla81
4102/10/2019Canada GooseBranta canadensis25
4202/10/2019Mute SwanCygnus olor2
4302/10/2019MallardAnas platyrhynchos6
4402/10/2019TealAnas crecca2
4508/10/2019GadwallMareca strepera4
4608/10/2019MallardAnas platyrhynchos14
4708/10/2019TealAnas crecca37
4816/10/2019Canada GooseBranta canadensis360
4922/10/2019Brent GooseBranta bernicla140
5022/10/2019Mute SwanCygnus olor1
5122/10/2019GadwallMareca strepera2
5222/10/2019MallardAnas platyrhynchos4
5322/10/2019TealAnas crecca1
5429/10/2019Canada GooseBranta canadensis20
5529/10/2019MallardAnas platyrhynchos18
5629/10/2019TealAnas crecca6
5703/11/2019GadwallMareca strepera2
5803/11/2019MallardAnas platyrhynchos5
5907/11/2019Brent GooseBranta bernicla3
6014/11/2019Brent GooseBranta bernicla200
6114/11/2019MallardAnas platyrhynchos3
6214/11/2019TealAnas crecca19
6320/11/2019Brent GooseBranta bernicla44
6420/11/2019GadwallMareca strepera34
6520/11/2019MallardAnas platyrhynchos9
6627/11/2019Canada GooseBranta canadensis2
6727/11/2019GadwallMareca strepera3
6827/11/2019MallardAnas platyrhynchos21
6927/11/2019TealAnas crecca3
7004/12/2019Brent GooseBranta bernicla43
7104/12/2019MallardAnas platyrhynchos8
7204/12/2019TealAnas crecca15
7311/12/2019Canada GooseBranta canadensis12
7411/12/2019ShelduckTadorna tadorna2
7511/12/2019MallardAnas platyrhynchos2
7618/12/2019Brent GooseBranta bernicla11
7718/12/2019GadwallMareca strepera1
7818/12/2019MallardAnas platyrhynchos8
7918/12/2019TealAnas crecca9
8001/01/2020Brent GooseBranta bernicla42
8101/01/2020ShelduckTadorna tadorna6
8201/01/2020MallardAnas platyrhynchos2
8301/01/2020TealAnas crecca25
8408/01/2020ShelduckTadorna tadorna2
8508/01/2020MallardAnas platyrhynchos13
8608/01/2020TealAnas crecca11
8715/01/2020Brent GooseBranta bernicla5
8815/01/2020ShelduckTadorna tadorna1
8915/01/2020MallardAnas platyrhynchos3
9015/01/2020TealAnas crecca1
9122/01/2020Brent GooseBranta bernicla2
9222/01/2020MallardAnas platyrhynchos3
9329/01/2020Brent GooseBranta bernicla7
9429/01/2020Canada GooseBranta canadensis5
9529/01/2020ShelduckTadorna tadorna3
9629/01/2020MallardAnas platyrhynchos7
9729/01/2020TealAnas crecca20
9805/02/2020Brent GooseBranta bernicla7
9905/02/2020Canada GooseBranta canadensis2
10005/02/2020ShelduckTadorna tadorna2
10105/02/2020WigeonMareca penelope1
10205/02/2020MallardAnas platyrhynchos7
10305/02/2020TealAnas crecca12
10412/02/2020Brent GooseBranta bernicla210
10512/02/2020ShelduckTadorna tadorna1
10612/02/2020WigeonMareca penelope10
10712/02/2020TealAnas crecca12
10819/02/2020Brent GooseBranta bernicla2
10919/02/2020Canada GooseBranta canadensis7
11019/02/2020ShelduckTadorna tadorna4
11119/02/2020TealAnas crecca10
11226/02/2020ShelduckTadorna tadorna4
11304/03/2020Canada GooseBranta canadensis8
11404/03/2020ShelduckTadorna tadorna12
11504/03/2020GadwallMareca strepera11
11604/03/2020MallardAnas platyrhynchos3
11704/03/2020TealAnas crecca47
Data
Cell Formulas
RangeFormula
A40:D117A40=LET(Hdr,C1:Y1,Data,A2:B36,nums,C2:Y36,c,COLUMNS(Hdr),s,SEQUENCE(ROWS(Data)*c,,0),xa,INDEX(Hdr,MOD(s,c)+1),xb,INDEX(Data,INT(s/c)+1,{1,2}),xc,INDEX(nums,INT(s/c)+1,MOD(s,c)+1),SORT(FILTER(CHOOSE({1,2,3,4},xa,INDEX(xb,,1),INDEX(xb,,2),xc),xc>0)))
Dynamic array formulas.
That is marvellous and works perfectly. I will now have to study it in detail to see what it's doing so I can learn this technique for myself. Many, many thanks.
 
Upvote 0
Glad we could help & thanks for the feedback.

If you have received the new functions such as HSTACK the formula can be simplified slightly to
Excel Formula:
=LET(Hdr,C1:Y1,Data,A2:B36,nums,C2:Y36,c,COLUMNS(Hdr),s,SEQUENCE(ROWS(Data)*c,,0),xa,INDEX(Hdr,MOD(s,c)+1),xb,INDEX(Data,INT(s/c)+1,{1,2}),xc,INDEX(nums,INT(s/c)+1,MOD(s,c)+1),SORT(FILTER(HSTACK(xa,xb,xc),xc>0)))
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top