Alright, I'm getting a good understanding for the code implied.
When I went to the UDF section and read up about this, there was alot more complicated code.

Anyways, I tried simply inserting the code you gave me, changing the names appropriately, but haven't come to any success.

Do I have to declare a function called primapstate and then call it later on?