# Pull values from sublist, add new values to sublist

**URL:** https://forum.dynamobim.com/t/pull-values-from-sublist-add-new-values-to-sublist/11754
**Category:** Revit
**Created:** [May 3, 2017, 11:10am UTC](https://forum.dynamobim.com/t/pull-values-from-sublist-add-new-values-to-sublist/11754 "2017-05-03T11:10:51Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![JFK](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jfk/32/30800_2.png) [@JFK](https://forum.dynamobim.com/u/JFK)
#### Post date: [May 3, 2017, 11:10am UTC](https://forum.dynamobim.com/t/pull-values-from-sublist-add-new-values-to-sublist/11754/1 "2017-05-03T11:10:51Z")

</div>

I am trying to pull out some data from sublists AND IF the data is the same, then I would like the next sublist data to add up. (please see the image below).  
The objective is to create one “routine” that permits my office to calculate the total Netto area of a serie of appartmens in a Building Block based on Revit Information and then export it to Excel for further processing.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/4/a404eccc3e72f52400096d3c21f57a6f455b6e4e.png)

I just started studying Dynamo a couple a weeks ago, I don’t know if my posted Workflow even make sense/or plausible.

Thank you all in advance for your Inputs.

---

<div class="post-metadata">

### Author: ![JFK](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jfk/32/30800_2.png) [@JFK](https://forum.dynamobim.com/u/JFK)
#### Post date: [May 12, 2017, 4:40pm UTC](https://forum.dynamobim.com/t/pull-values-from-sublist-add-new-values-to-sublist/11754/3 "2017-05-12T16:40:23Z")

</div>

@erfajo Thank you for your help and sorry for the late answer. I am not having so much time to play with Dynamo after work lately.  
Indeed the “GroupByKey” kind of sorted out my list and helped me to organize this script. Actually I got almost what I want. The script works now if we specific one Item from the list - “3” in this case. My goal is but to add all the areas that have the same apartment number (which is represented by the index 1 in all the sub lists).

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/e/0e8b6b4ef94e8782e43340eb364c3d9371b27c62.png)

Do I have to play around with the Code Node which is set for the value “3” (indicates the apartment 3)?  
Thanks again for the possible Input!

---

<div class="post-metadata">

### Author: ![JFK](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jfk/32/30800_2.png) [@JFK](https://forum.dynamobim.com/u/JFK)
#### Post date: [May 13, 2017, 12:50pm UTC](https://forum.dynamobim.com/t/pull-values-from-sublist-add-new-values-to-sublist/11754/4 "2017-05-13T12:50:45Z")

</div>

The .dyn and .rvt files:

[170512 Test Fläche Code with several Apartments.dyn](https://forum.dynamobim.com/uploads/short-url/x8DYlZWkLC4sk2Z35uOOoVryYqr.dyn) (17.9 KB)  
[170503 Test Fläche 2017.rvt](https://forum.dynamobim.com/uploads/short-url/hMPkieLxRVZtMxfojJ3sA803WUr.rvt) (1016 KB)

---

<div class="post-metadata">

### Author: ![Ritesh\_Chandawar](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@Ritesh\_Chandawar](https://forum.dynamobim.com/u/Ritesh_Chandawar)
#### Post date: [May 14, 2017, 8:32am UTC](https://forum.dynamobim.com/t/pull-values-from-sublist-add-new-values-to-sublist/11754/6 "2017-05-14T08:32:14Z")

</div>

@JFK I tried with simple out of the box nodes.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/b/1bc9ce2aa4a3fd5a41baacb07c9f87fce4137df8.png)

---

<div class="post-metadata">

### Author: ![JFK](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jfk/32/30800_2.png) [@JFK](https://forum.dynamobim.com/u/JFK)
#### Post date: [May 14, 2017, 1:54pm UTC](https://forum.dynamobim.com/t/pull-values-from-sublist-add-new-values-to-sublist/11754/7 "2017-05-14T13:54:39Z")

</div>

@erfajo , @Ritesh_Chandawar thank you both for the answers with different approaches. I will try to learn something from your both scripts since I’m new to Dynamo and Coding.

Cheers!
