# Re-Order Excel list to match Revit Floorplan order

**URL:** https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152
**Category:** Revit
**Created:** [September 27, 2017, 12:48pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152 "2017-09-27T12:48:46Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Dannywi11iams](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@Dannywi11iams](https://forum.dynamobim.com/u/Dannywi11iams)
#### Post date: [September 27, 2017, 12:48pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/1 "2017-09-27T12:48:46Z")

</div>

[Reorder Excel.dyn](https://forum.dynamobim.com/uploads/short-url/5LzvXijulYdJHt2yowRl6mTCNS3.dyn) (16.6 KB)

[Reorder Excel.xlsx](https://forum.dynamobim.com/uploads/short-url/qSFM9LygIMGwBKjHwwa7FJS7CG2.xlsx) (11.8 KB)

Hi, I’m new to Dynamo and I’m having trouble reordering a Excel sheet to match up with my floorplan views.

In my Excel sheet I have the drawing numbers generated and broken down in to columns. Where I get Dynamo to create the levels and then views. I want my Dynamo graph to copy existing views that have been set up within the Revit File which have been called "MASTER - "  
 ![Views Masters](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/1/819a4d24f585f9a0f2a9f489d7f208583ee4a493.PNG)

What I’m trying to achieve is copying the views and renaming them from the data from the Excel file. As following :-

 ![Example Of Data](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/e/fe5e30ee2add587bcfe82eaeafd4bd5eb5c928a7.PNG)

The boxed number are in the wrong place.

But as you can see this is not happening. The associated levels to the views name do not match.  
When the data is read from the Excel file it is read in a order grouped by the “drawing type” and then the “level”. But once a level as been created in Revit and viewed it is shown as being in alphabetically order.

![First Time Rename](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/8/e861ce2bb7991d9d3b22cce269fac9f10a45d715.PNG)

How do I reorder and rename a view that is read from Excel, to maintain the order that is read from Revit in order to rename the correct view associated the corresponding level.

I think I ether need to alternated the numbers to the views, or some how find a key value to rename all “Copy 1” = 600 and all “Copy 2” as 500,

I’m really at a point now where I’ve looked at this so much that I cant see the forest for the trees.

any help would be appreciated.

I can’t really up the whole graph as I played around and created some custom nodes.

---

<div class="post-metadata">

### Author: ![khuzaimah.ElecEng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/khuzaimah.eleceng/32/92768_2.png) [@khuzaimah.ElecEng](https://forum.dynamobim.com/u/khuzaimah.ElecEng)
#### Post date: [September 27, 2017, 2:21pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/2 "2017-09-27T14:21:08Z")

</div>

if your case as i understand just to change Copy 1 to 600 & Copy 2 to 500

just get view name parameter then replace the values you want!  
 ![Untitled](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/f/1/f1401efb9638d265e24e92eaa276f79a89ea8c9b.png)

after that use set parameter tool to replace view name with new one

---

<div class="post-metadata">

### Author: ![Dannywi11iams](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@Dannywi11iams](https://forum.dynamobim.com/u/Dannywi11iams)
#### Post date: [September 27, 2017, 7:44pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/3 "2017-09-27T19:44:06Z")

</div>

Khuzaimah, i tried this but found if i have more than the two drawing types (which start from 600…699 and 500…599) the drawing levels from Revit will not become associated to different amounts of levels, the list still then falls out of sync.

i require a base point to refer back to and relabel the correct level.

I’m unsure how i can create an unique list of 600’s 500’s (and what ever other number i require) count how many copies i have and assign that amount and rename them.

If anyone as an example of this i could give that a go in my graph.

---

<div class="post-metadata">

### Author: ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)
#### Post date: [September 27, 2017, 8:37pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/4 "2017-09-27T20:37:21Z")

</div>

Use Count and List.Cycle to get the necessary number of levels.

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

---

<div class="post-metadata">

### Author: ![Dannywi11iams](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@Dannywi11iams](https://forum.dynamobim.com/u/Dannywi11iams)
#### Post date: [September 27, 2017, 9:41pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/5 "2017-09-27T21:41:30Z")

</div>

Thanks Nick for getting back, before a try this can i just run something by you.

If i have masters views created and i needed to duplicate the view would i count the number of copies and the number of drawing types to compare them in order to determine how many to rename?

![Excel Screen Shot](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/6/b/6b58cef19d9adc0bffa46b9fa850dae6a4eff8ab.PNG)

From the screen shot above the green and blues in the list need to be duplicates of the masters levels/views already setup in the project, Where as the blue and yellows need to be dependant of the previous created blue duplicate. Would i need to count this information from the excel spread sheet. Because once the masters are created, both lists fall out of sync, as the Revit list would be listed alphabetically where as my excel sheet is grouped in to drawing types to help the engineers see how many drawings need to be create easily.

My uploaded dynamo graph shows what I have, and how I’m trying to pair up the information. But running this for the dependent views I get errors from the Code Block with the “IF” statements in, this is due to the value “1”…“3”… will/could never always be in the Revit views list.

![Reorder Excel Info](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/a/2/a2cfd93217ee79b9c5ff2fdf9f5d1f230ae14a63.png)

I hope this is clear to all, and i hope you understand what i’m trying to explain. if you require any more info please ask and i’ll try my best.

---

<div class="post-metadata">

### Author: ![Dannywi11iams](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@Dannywi11iams](https://forum.dynamobim.com/u/Dannywi11iams)
#### Post date: [October 2, 2017, 12:26pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/6 "2017-10-02T12:26:39Z")

</div>

> [@Nick\_Boyts](#):
>
> Use Count and List.Cycle to get the necessary number of levels.
> 
> ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/c/1ce36de62b57750f63b81e4cc8f5353f918f2d8e.png)

Nick

After trying your suggestion, I’m still in the same situation as before.

 ![NickBoytsReply](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/6/96e985abc40a5b125b7b209fc8a4e8f34fe6ed4d.PNG)

I need to reorder the drawing types (600 - 500…) which are read from my excel sheet to fall in line with the alphabetically list that comes back out of Revit. see post below (above (5/5))

---

<div class="post-metadata">

### Author: ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)
#### Post date: [October 2, 2017, 4:50pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/7 "2017-10-02T16:50:23Z")

</div>

If they are named the same then just sort both lists by the same method (alphabetically in this case).

---

<div class="post-metadata">

### Author: ![Dannywi11iams](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@Dannywi11iams](https://forum.dynamobim.com/u/Dannywi11iams)
#### Post date: [August 31, 2018, 11:27am UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/8 "2018-08-31T11:27:08Z")

</div>

Hi all I’ve had to but this on the back burnner for a while, and now i’ve had time to return back to it.

Is there a way to match up the order of one list with the orginal order of the source. I’m sure there is, but I can’t find a way of doing it.

That way the data will match up with the source data in the correct order for the output data to be correct.(if that make sence)

---

<div class="post-metadata">

### Author: ![yamanyildirim](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yamanyildirim/32/52682_2.png) [@yamanyildirim](https://forum.dynamobim.com/u/yamanyildirim)
#### Post date: [August 31, 2018, 12:22pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/9 "2018-08-31T12:22:33Z")

</div>

Normally i order lists as below but cross product can be very slow when there are lots fo data on your list.

 ![sort](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/9/693bd669d9f2914fd3d879ea3b1dcde083c1e484.png)

---

<div class="post-metadata">

### Author: ![Dannywi11iams](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@Dannywi11iams](https://forum.dynamobim.com/u/Dannywi11iams)
#### Post date: [August 31, 2018, 12:24pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/10 "2018-08-31T12:24:05Z")

</div>

Thanks Yam, I’ll give that ago

---

<div class="post-metadata">

### Author: ![mellouze](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mellouze](https://forum.dynamobim.com/u/mellouze)
#### Post date: [August 31, 2018, 12:33pm UTC](https://forum.dynamobim.com/t/re-order-excel-list-to-match-revit-floorplan-order/15152/11 "2018-08-31T12:33:31Z")

</div>

> [@Dannywi11iams](#):
>
> match up the order of one list with the orginal order of the source

Try nodes like **List.GetItemAtIndex** and **List.IndexOf** , they are really useful whern trying to ‘remember’ the order of a given list.

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

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