# Counting occurences per level and arrange these values by a predetermined list

#1

Hi I have lists grouped by level showing each rooms occupancy. I am trying to count these occurrences of units per level and arrange them in a particular order before exporting the values to excel.

Below is the original list of “occupancy” values organized per level.:

-[0]
—[0]1 BED
—[1]1 BED
—[2]1 BED+ST
—[3]2 BED
—[4]3 BED
—[5]3 BED+ST
—[6]3 BED+ST
-[1]
—[0]3 BED+ST
—[1]3 BED+ST
—[2]2 BED+ST
—[3]2 BED
—[4]1 BED
—[5]1 BED
—[6]1 BED

I want to count occurrences but order them by a defined list as shown below:

-[0]
—[0]1 BED
—[1]1 BED+ST
—[2]2 BED
—[3]2 BED+ST
—[4]3 BED
—[5]3 BED+ST

Therefore I can produce total counts of “1 BED”, “1 BED+ST”, etc. per level in a specific order like below…

-[0]
—[0]2
—[1]1
—[2]1
—[3]0
—[4]1
—[5]2
-[1]
—[0]3
—[1]0
—[2]1
—[3]1
—[4]0
—[5]2

Where there is no occurrence I want to produce just a “0” instead of “null”.

Any help would be appreciated!

#2

Since your data is ending up in Excel, I would keep it simple and use Excel to process all of the data as its without question the best tool for processing data. Its going to be far more efficient, plus any one can open an Excel spreadsheet - not everyone can (or will) open a Dynamo definition!

#3

This should give you what you are after.
Room Occurences by Level.dyn (10.4 KB)

Room Count by Name and export it to Excel
#4

Scott, Thank you very much for your assistance. That’s exactly what I was after!

#5

Thanks Scott… greats!