# Return to Answer

 3 replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/ edited Apr 13 '17 at 12:55 Please see a potential solution below: Code: (*Data sample*) names = {"a", "b", "c", "d", "e", "f", "g"}; extr = {{{"a", "c"}, "q"}, {{"b", "e", "f"}, "r"}, {{"a", "b"}, "s"}}; data = {{{1}, {1.5, 1.5}, {2, 2, 2}}, {{2}, {2.5, 2.5}, {3, 3, 3}}, {{3}, {3.5, 3.5}, {4, 4, 4}}, {{4}, {4.5, 4.5}, {5, 5, 5}}, {{5}, {5.5, 5.5}, {6, 6, 6}}, {{6}, {6.5, 6.5}, {7, 7, 7}}, {{7}, {7.5, 7.5}, {8, 8, 8}}}; (*Operation*) Total@data[[#]] & /@ (extr /. Association[Table[#[[i]] -> i, {i, Length@#}] &[names]])[[All, 1]]  Output: {{{4}, {5., 5.}, {6, 6, 6}}, {{13}, {14.5, 14.5}, {16, 16, 16}}, {{3}, {4., 4.}, {5, 5, 5}}} Please see a potential solution below: Code: (*Data sample*) names = {"a", "b", "c", "d", "e", "f", "g"}; extr = {{{"a", "c"}, "q"}, {{"b", "e", "f"}, "r"}, {{"a", "b"}, "s"}}; data = {{{1}, {1.5, 1.5}, {2, 2, 2}}, {{2}, {2.5, 2.5}, {3, 3, 3}}, {{3}, {3.5, 3.5}, {4, 4, 4}}, {{4}, {4.5, 4.5}, {5, 5, 5}}, {{5}, {5.5, 5.5}, {6, 6, 6}}, {{6}, {6.5, 6.5}, {7, 7, 7}}, {{7}, {7.5, 7.5}, {8, 8, 8}}}; (*Operation*) Total@data[[#]] & /@ (extr /. Association[Table[#[[i]] -> i, {i, Length@#}] &[names]])[[All, 1]]  Output: {{{4}, {5., 5.}, {6, 6, 6}}, {{13}, {14.5, 14.5}, {16, 16, 16}}, {{3}, {4., 4.}, {5, 5, 5}}} Reference: Association Table /. | @ | # | & etc. Please see a potential solution below: Code: (*Data sample*) names = {"a", "b", "c", "d", "e", "f", "g"}; extr = {{{"a", "c"}, "q"}, {{"b", "e", "f"}, "r"}, {{"a", "b"}, "s"}}; data = {{{1}, {1.5, 1.5}, {2, 2, 2}}, {{2}, {2.5, 2.5}, {3, 3, 3}}, {{3}, {3.5, 3.5}, {4, 4, 4}}, {{4}, {4.5, 4.5}, {5, 5, 5}}, {{5}, {5.5, 5.5}, {6, 6, 6}}, {{6}, {6.5, 6.5}, {7, 7, 7}}, {{7}, {7.5, 7.5}, {8, 8, 8}}}; (*Operation*) Total@data[[#]] & /@ (extr /. Association[Table[#[[i]] -> i, {i, Length@#}] &[names]])[[All, 1]]  Output: {{{4}, {5., 5.}, {6, 6, 6}}, {{13}, {14.5, 14.5}, {16, 16, 16}}, {{3}, {4., 4.}, {5, 5, 5}}} Reference: Association Table /. | @ | # | & etc. 2 Added missing data sample set edited Nov 27 '15 at 12:08 e.doroskevic 4,67511 gold badge77 silver badges2525 bronze badges Please see a potential solution below: Code: (*Data sample*) names = {"a", "b", "c", "d", "e", "f", "g"}; extr = {{{"a", "c"}, "q"}, {{"b", "e", "f"}, "r"}, {{"a", "b"}, "s"}}; data = {{{1}, {1.5, 1.5}, {2, 2, 2}}, {{2}, {2.5, 2.5}, {3, 3, 3}}, {{3}, {3.5, 3.5}, {4, 4, 4}}, {{4}, {4.5, 4.5}, {5, 5, 5}}, {{5}, {5.5, 5.5}, {6, 6, 6}}, {{6}, {6.5, 6.5}, {7, 7, 7}}, {{7}, {7.5, 7.5}, {8, 8, 8}}}; (*Operation*) Total@data[[#]] & /@ (extr /. Association[Table[#[[i]] -> i, {i, Length@#}] &[names]])[[All, 1]]  Output: {{{4}, {5., 5.}, {6, 6, 6}}, {{13}, {14.5, 14.5}, {16, 16, 16}}, {{3}, {4., 4.}, {5, 5, 5}}} Reference: Association Table /. | @ | # | & etc. Please see a potential solution below: Code: (*Data sample*) names = {"a", "b", "c", "d", "e", "f", "g"}; extr = {{{"a", "c"}, "q"}, {{"b", "e", "f"}, "r"}, {{"a", "b"}, "s"}}; (*Operation*) Total@data[[#]] & /@ (extr /. Association[Table[#[[i]] -> i, {i, Length@#}] &[names]])[[All, 1]]  Output: {{{4}, {5., 5.}, {6, 6, 6}}, {{13}, {14.5, 14.5}, {16, 16, 16}}, {{3}, {4., 4.}, {5, 5, 5}}} Reference: Association Table /. | @ | # | & etc. Please see a potential solution below: Code: (*Data sample*) names = {"a", "b", "c", "d", "e", "f", "g"}; extr = {{{"a", "c"}, "q"}, {{"b", "e", "f"}, "r"}, {{"a", "b"}, "s"}}; data = {{{1}, {1.5, 1.5}, {2, 2, 2}}, {{2}, {2.5, 2.5}, {3, 3, 3}}, {{3}, {3.5, 3.5}, {4, 4, 4}}, {{4}, {4.5, 4.5}, {5, 5, 5}}, {{5}, {5.5, 5.5}, {6, 6, 6}}, {{6}, {6.5, 6.5}, {7, 7, 7}}, {{7}, {7.5, 7.5}, {8, 8, 8}}}; (*Operation*) Total@data[[#]] & /@ (extr /. Association[Table[#[[i]] -> i, {i, Length@#}] &[names]])[[All, 1]]  Output: {{{4}, {5., 5.}, {6, 6, 6}}, {{13}, {14.5, 14.5}, {16, 16, 16}}, {{3}, {4., 4.}, {5, 5, 5}}} Reference: Association Table /. | @ | # | & etc. 1 answered Nov 27 '15 at 11:48 e.doroskevic 4,67511 gold badge77 silver badges2525 bronze badges Please see a potential solution below: Code: (*Data sample*) names = {"a", "b", "c", "d", "e", "f", "g"}; extr = {{{"a", "c"}, "q"}, {{"b", "e", "f"}, "r"}, {{"a", "b"}, "s"}}; (*Operation*) Total@data[[#]] & /@ (extr /. Association[Table[#[[i]] -> i, {i, Length@#}] &[names]])[[All, 1]]  Output: {{{4}, {5., 5.}, {6, 6, 6}}, {{13}, {14.5, 14.5}, {16, 16, 16}}, {{3}, {4., 4.}, {5, 5, 5}}} Reference: Association Table /. | @ | # | & etc.