List Indexing Dynamo?

I have a group of spaces in my model. We have an excel spreadsheet that we’re using to push various design values into those Revit spaces using Dynamo as the bridge. Inevitably the space number will be changed, either in Revit, excel or both. When I go to update the design values in Revit I need to be able to align the space numbers in Revit with those found in the excel sheet. If there are a different quantity of spaces in either place, the values will get dropped into the wrong space.

For example, there presently 140 spaces in the Revit model but only 137 in the excel spreadsheet. Space 1109 is one of the spaces missing from the excel data. As Dynamo works through the lists dropping in the values, it doesn’t find the data for 1109 so the data for 1110 is dropped into space 1109, and every space thereafter in the list is wrong.

I’m sure there is a simple solution but I haven’t found an example specific enough to solve my issue. Please help this Dynamo noob. My mind wanders if there’s not a Dynamo version of the excel lookup or index command to look for a matching space number between the lists and drop the data in where it finds the match. Thanks for the help!

Hello Nick,
List.AllIndices in combination with GetItemAtIndex works great for these kind of queries. I use it like this:

This way it doesn’t matter if a number gets dropped from excel.

1 Like

Can you send the script, the image is unreadable.

Sure: Space excel number matching.dyn (17.6 KB)
The image should be readable though if you click and download it.

This has worked perfectly! Thanks so much for your willingness to help.

1 Like