Question: I'm working on a project and all going swimingly so far until I hit the maths wall. 

At the moment we work this out by hand by reverse engineering from a number we already know the answer too (2114) but with each of us working it out slightly different and it taking quite awhile sometimes as none of us are very good with a calculator we always end up if slightly different results. Hence the need for something that works it out. And adding it to our intranet.

Any help working this out would be awesome. thanks.

Rules;

Get Number(gap) Between 590 -> 4500

Work out the sizes of Panel & Infills required to fill this gap with the below rules;

Panels must = odd number

Infills (if required) must = even number & be no more than 1 higher in quantity than Panels

Minumum Size for Panels = 590
Max Size for Panels = 705

Minimum Size for Infills = 75
Max Size for Infills = 175

I don't currently have a formula for an example (because I don't even know where to start) All I've managed to do is some really basic: gap / 705 = a then if a isn't a whole number find the difference and do diff / 75 = b but keep repeating this until i get anywhere near a good size.

I'm not even sure what tags to use.

Answer: 
The suggestion given by *awkward* is quite useful: Excel Solver
can work this problem out.  

However, since there is not a single solution, the Solver
will provide you with the first it is going to find.

Before going "fully authomatically" I would suggest an intermediate
step, going through a graphical program.

Consider in fact to call $n$ the number of panels, $x$ their size, 
$m$ the number of infills , $y$ the size of them and $G$ the gap size.

Then you shall have
$$
n\,x + m\,y = G
$$
rewrite it as
$$
{n \over {G/x}}\, + {m \over {G/y}}\, = {n \over a}\, + {m \over b} = 1
$$
which, in the plane $n,m$ is the equation of a line with intercepts at $n=a$ and $m=b$.

[![Panels_infills_1](https://i.stack.imgur.com/Z2m43.png)](https://i.stack.imgur.com/Z2m43.png)

Referring to the sketch above, you actually have just a few points $(n,m)$ to test.  

So choose one of them, draw a line through it, determine the intercepts, and given $G$
find $(x,y)$ and check whether they obey the relative bounds.

You can use a graphic system like Geogebra to automate the calculation and representation 
of the point in $x,y$ in function of the change that you make to the line.

These first trials will also indicate, depending on other technical features/conditions you might desire,
whether and how you can fix an optimization function on $x,y$, which then will  

allow a "Solver" to provide a unique answer.
I'm pretty sure there is no formula for this. You will need an algorithm. 

Your problem is related to the typesetting problem for right justifying lines - you need to put some words (your panels) of varying lengths into a fixed length line (your gap) with whitespace (your infills) between words. 

There's a lot of literature on this that may help. The search for 
[typography line justification algorithms](https://www.google.com/search?client=firefox-b-1&ei=dzTSWsb4KcvI5gLYnLXQBA&q=typography%20line%20justification%20algorithms&oq=typography%20line%20justification%20algori&gs_l=psy-ab.1.1.33i21k1j33i160k1.18950.21858.0.24292.13.13.0.0.0.0.166.1080.11j2.13.0....0...1.1.64.psy-ab..0.11.918...33i22i29i30k1.0.vSjT8J4w12U) is a place to start - read about how to do it, not whether to do it.

It's not clear from your question whether you are free to vary the lengths of the panels, or whether they are given with fixed bounded lengths (like words).

You started in a reasonable way, by trying to guess at the (largest?) number of panels that will fit. Then, as you say

> 
> keep repeating this until i get anywhere near a good size.
> 
> 
> 

If you can make the conditions/requirements a little more formal you could consult a local computer science savvy person for an algorithm, or ask at stackexchange.com

Good luck.