# How to get last index value of sublists?

**URL:** <https://forum.dynamobim.com/t/how-to-get-last-index-value-of-sublists/41096>\
**Category:** Revit\
**Tags:** revit, dynamo\
**Created:** [September 25, 2019, 11:24pm UTC](https://forum.dynamobim.com/t/how-to-get-last-index-value-of-sublists/41096 "2019-09-25T23:24:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ppokharna](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@ppokharna](https://forum.dynamobim.com/u/ppokharna)\
**Post date:** [September 25, 2019, 11:24pm UTC](https://forum.dynamobim.com/t/how-to-get-last-index-value-of-sublists/41096/1 "2019-09-25T23:24:36Z")

</div>

Hi all,

I’m stuck at a point where i need to create a list of all the “Last index values of my sublists” and cannot think of anything to move further. Attached within is the screenshot of my list with sublists and highlighted are the values i need to be created as a new list!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/5/95928319db4583f696e33671800453a453cf0d43.png)

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![cgartland](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cgartland/32/45378_2.png) [@cgartland](https://forum.dynamobim.com/u/cgartland)\
**Post date:** [September 25, 2019, 11:55pm UTC](https://forum.dynamobim.com/t/how-to-get-last-index-value-of-sublists/41096/2 "2019-09-25T23:55:56Z")

</div>

Assuming each list does not have any repeating values, you can use the [List.LastItem](https://dictionary.dynamobim.com/2/#/List/Inspect/Action/LastItem) node @L2, then use the [List.IndexOf](https://dictionary.dynamobim.com/2/#/List/Inspect/Action/IndexOf) with proper levels to get the index of each item. So, List.LastItem would give you `[[7], [9], [9]]` and List.IndexOf would give you `[[2], [3], [3]]`.

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [September 26, 2019, 1:55am UTC](https://forum.dynamobim.com/t/how-to-get-last-index-value-of-sublists/41096/3 "2019-09-26T01:55:05Z")

</div>

Change the Levels (play arrows) to get different depths in your lists.

---

<div class="post-metadata">

**Author:** ![ppokharna](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@ppokharna](https://forum.dynamobim.com/u/ppokharna)\
**Post date:** [September 26, 2019, 4:26pm UTC](https://forum.dynamobim.com/t/how-to-get-last-index-value-of-sublists/41096/4 "2019-09-26T16:26:44Z")

</div>

Thankyou @cgartland and @SeanP. That was pretty easy than i thought! I appreciate your time and consideration!
