I have a list looking like this;
{{"ADS GY Equity", "", "", "ALV GY Equity", "", "", "BAS GY Equity",
"", "", "BAYN GY Equity", "", "", "BEI GY Equity", "", "",
"BMW GY Equity", ""}, {"Date", "PX_LAST", "", "Date", "PX_LAST", "",
"Date", "PX_LAST", "", "Date", "PX_LAST", "", "Date", "PX_LAST",
"", "Date", "PX_LAST"}, {"addidas", 17.925, "", "alvac", 287.292,
"", "basse", 24.875, "", "bayern", 42.34, "", "begge", 23.667, "",
"BMW", 29.49}, {{2000, 1, 4, 0, 0, 0.}, 17.5,
"", {2000, 1, 4, 0, 0, 0.}, 285.934, "", {2000, 1, 4, 0, 0, 0.},
23.925, "", {2000, 1, 4, 0, 0, 0.}, 41.216,
"", {2000, 1, 4, 0, 0, 0.}, 21.333, "", {2000, 1, 4, 0, 0, 0.},
28.3}, {{2000, 1, 5, 0, 0, 0.}, 17.5, "", {2000, 1, 5, 0, 0, 0.},
294.078, "", {2000, 1, 5, 0, 0, 0.}, 23.375,
"", {2000, 1, 5, 0, 0, 0.}, 40.176, "", {2000, 1, 5, 0, 0, 0.}, 21.,
"", {2000, 1, 5, 0, 0, 0.}, 27.74}, {{2000, 1, 6, 0, 0, 0.}, 18.25,
"", {2000, 1, 6, 0, 0, 0.}, 297.698, "", {2000, 1, 6, 0, 0, 0.},
24.015, "", {2000, 1, 6, 0, 0, 0.}, 41.356,
"", {2000, 1, 6, 0, 0, 0.}, 21.867, "", {2000, 1, 6, 0, 0, 0.},
27.65}, {{2000, 1, 7, 0, 0, 0.}, 18., "", {2000, 1, 7, 0, 0, 0.},
305.977, "", {2000, 1, 7, 0, 0, 0.}, 25.,
"", {2000, 1, 7, 0, 0, 0.}, 43.08, "", {2000, 1, 7, 0, 0, 0.},
22.33, "", {2000, 1, 7, 0, 0, 0.}, 27.6}, {{2000, 1, 10, 0, 0, 0.},
18.272, "", {2000, 1, 10, 0, 0, 0.}, 307.742,
"", {2000, 1, 10, 0, 0, 0.}, 25.11, "", {2000, 1, 10, 0, 0, 0.},
44.644, "", {2000, 1, 10, 0, 0, 0.}, 22.667,
"", {2000, 1, 10, 0, 0, 0.}, 28.7}, {{2000, 1, 11, 0, 0, 0.},
18.103, "", "", "", "", {2000, 1, 11, 0, 0, 0.}, 23.995,
"", {2000, 1, 11, 0, 0, 0.}, 43.323, "", {2000, 1, 11, 0, 0, 0.},
21.883, "", {2000, 1, 11, 0, 0, 0.},
28.6}, {{2000, 1, 12, 0, 0, 0.}, 18., "", "", "",
"", {2000, 1, 12, 0, 0, 0.}, 24., "", {2000, 1, 12, 0, 0, 0.},
41.45, "", {2000, 1, 12, 0, 0, 0.}, 21.717,
"", {2000, 1, 12, 0, 0, 0.}, 28.19}, {{2000, 1, 13, 0, 0, 0.},
17.462, "", "", "", "", {2000, 1, 13, 0, 0, 0.}, 23.75,
"", {2000, 1, 13, 0, 0, 0.}, 41.169, "", {2000, 1, 13, 0, 0, 0.},
22.163, "", {2000, 1, 13, 0, 0, 0.},
27.4}, {{2000, 1, 14, 0, 0, 0.}, 16.837, "", "", "",
"", {2000, 1, 14, 0, 0, 0.}, 23.75, "", {2000, 1, 14, 0, 0, 0.},
42.152, "", {2000, 1, 14, 0, 0, 0.}, 22.583,
"", {2000, 1, 14, 0, 0, 0.}, 27.2}, {{2000, 1, 17, 0, 0, 0.}, 17.,
"", "", "", "", {2000, 1, 17, 0, 0, 0.}, 23.935, "", "", "",
"", {2000, 1, 17, 0, 0, 0.}, 23.33, "", {2000, 1, 17, 0, 0, 0.},
27.28}, {{2000, 1, 18, 0, 0, 0.}, 17., "", "", "",
"", {2000, 1, 18, 0, 0, 0.}, 23.975, "", "", "",
"", {2000, 1, 18, 0, 0, 0.}, 22.667, "", {2000, 1, 18, 0, 0, 0.},
27.}, {{2000, 1, 19, 0, 0, 0.}, 16.65, "", "", "",
"", {2000, 1, 19, 0, 0, 0.}, 24.92, "", "", "",
"", {2000, 1, 19, 0, 0, 0.}, 23.3, "", {2000, 1, 19, 0, 0, 0.},
27.59}}
I want to extract every list which has length 14 or 15. This should leave me with eight lists, because I also want to drop the lists/columns with no values in it.
This is how the output should look like after extraction
{{{"ADS GY Equity", "", "BAS GY Equity", "", "BEI GY Equity", "",
"BMW GY Equity", ""}, {"Date", "PX_LAST", "Date", "PX_LAST",
"Date", "PX_LAST", "Date", "PX_LAST"}, {"addidas", 17.925, "basse",
24.875, "begge", 23.667, "BMW", 29.49}, {{2000, 1, 4, 0, 0, 0.},
17.5, {2000, 1, 4, 0, 0, 0.}, 23.925, {2000, 1, 4, 0, 0, 0.},
21.333, {2000, 1, 4, 0, 0, 0.}, 28.3}, {{2000, 1, 5, 0, 0, 0.},
17.5, {2000, 1, 5, 0, 0, 0.}, 23.375, {2000, 1, 5, 0, 0, 0.},
21., {2000, 1, 5, 0, 0, 0.}, 27.74}, {{2000, 1, 6, 0, 0, 0.},
18.25, {2000, 1, 6, 0, 0, 0.}, 24.015, {2000, 1, 6, 0, 0, 0.},
21.867, {2000, 1, 6, 0, 0, 0.}, 27.65}, {{2000, 1, 7, 0, 0, 0.},
18., {2000, 1, 7, 0, 0, 0.}, 25., {2000, 1, 7, 0, 0, 0.},
22.33, {2000, 1, 7, 0, 0, 0.}, 27.6}, {{2000, 1, 10, 0, 0, 0.},
18.272, {2000, 1, 10, 0, 0, 0.}, 25.11, {2000, 1, 10, 0, 0, 0.},
22.667, {2000, 1, 10, 0, 0, 0.}, 28.7}, {{2000, 1, 11, 0, 0, 0.},
18.103, {2000, 1, 11, 0, 0, 0.}, 23.995, {2000, 1, 11, 0, 0, 0.},
21.883, {2000, 1, 11, 0, 0, 0.}, 28.6}, {{2000, 1, 12, 0, 0, 0.},
18., {2000, 1, 12, 0, 0, 0.}, 24., {2000, 1, 12, 0, 0, 0.},
21.717, {2000, 1, 12, 0, 0, 0.}, 28.19}, {{2000, 1, 13, 0, 0, 0.},
17.462, {2000, 1, 13, 0, 0, 0.}, 23.75, {2000, 1, 13, 0, 0, 0.},
22.163, {2000, 1, 13, 0, 0, 0.}, 27.4}, {{2000, 1, 14, 0, 0, 0.},
16.837, {2000, 1, 14, 0, 0, 0.}, 23.75, {2000, 1, 14, 0, 0, 0.},
22.583, {2000, 1, 14, 0, 0, 0.}, 27.2}, {{2000, 1, 17, 0, 0, 0.},
17., {2000, 1, 17, 0, 0, 0.}, 23.935, {2000, 1, 17, 0, 0, 0.},
23.33, {2000, 1, 17, 0, 0, 0.}, 27.28}, {{2000, 1, 18, 0, 0, 0.},
17., {2000, 1, 18, 0, 0, 0.}, 23.975, {2000, 1, 18, 0, 0, 0.},
22.667, {2000, 1, 18, 0, 0, 0.}, 27.}, {{2000, 1, 19, 0, 0, 0.},
16.65, {2000, 1, 19, 0, 0, 0.}, 24.92, {2000, 1, 19, 0, 0, 0.},
23.3, {2000, 1, 19, 0, 0, 0.}, 27.59}}}
If I where to explain simply what has been done, It only extracted the companies date and closing price where the number of closing prices was equal to the number of longest number of closing prices for any of the companies.
""
none of the lists are length 14 or 15. With your data asdat
Length /@ DeleteCases[dat, "", {2}]
yields{6, 12, 12, 12, 12, 12, 12, 12, 10, 10, 10, 10, 8, 8, 8}
$\endgroup$