I believe this has been covered in other threads as WWHub has mentioned.
You are going to need some parameters to achieve what you are after. Basic logic you will need is IF parameters. As many people have said, you need to start with the bones of a family before you add the flesh (aka ref lines/parameters before solids).
To figure this out you need to understand the contraints you require... such as, is the spacing fixed (so always at 100mm spacing) or cant it be say 80mm to get that extra bar (as the spacing cannot exceeding 100mm?). Once you have that figured out, you can work out the formula to achieve what you need. So in essence, your formula needs to be applied to the array number and calculate how many bars you need to complete the array. So for example if Height was 1000mm...
Array = Height / 100 will return "10". However as you need to have less than the actually Height parameter's value to use, you need to adapt it accordingly, so Array=(Height - 100) / 100) would return "9".
However depending on contraints to Height you need to also consider how to achieve a whole number, so I'd recommend a rounddown(Array).
In regards to starting logic, I would recommend visually working from the centre outwards, so you will be working with 4 half arrays (See image). As I think that would look nicer, but then, thats just my opinion. If you take this route just remember to halve the Width and Height parameter Values in your formulas.
Finally, in regards to your array not sticking to your reference planes... pass. However you can resolve this by creating the bar element and its array in a seperate family and then link the child's parameters to the host/parent family's parameters. With the new family you can lock it at the base and then set it's height parameter to "Height - (o1 * 2)"
Anyway, good luck Luke. I haven't attached a family as its a good chance to have a go at learning this yourself. If you get stuck I will try and help you out but won't do it for you, well not until you have had a good go at it
EDIT: https://www.revitforum.org/tutorials-tips-tricks/1046-revit-formulas-everyday-usage.html is a great post about formulas.
Edited on: Tue, Jul 2, 2019 at 7:03:48 AM
"Try not to become a man of success, but rather to become a man of value"