Difficult (for me) formula/UDF calculation
I need a formula and am finding it difficult. I created a UDF to avoid
hassles with #VALUE! etc (sometimes a "?" is entered so I can't divide
it), giving me trouble but am stuck on this.
Imagine I have to take samples from a number of containers. The number
of samples needed (every 4th container, every 20th, etc) varies
according to source. There must always be a minimujm of 2 samples if the
containers number more than 1.
Assuming every 3rd container is to be sampled,
In my UDF I have a select case with
case 1 sample = 1 (this covers 1st)
case 2 to number_of_containers+1 sample = 2 (this covers 1st & 4th)
else
It is the else bit that has me stumped. I had
= total_containers/skip_rate + 1 but she no work.
I find it hard because I am not mathematically inclined and the fact
that the samples required change from every 3rd, 4th and up to 60th
really throws me. Is there something staring me in the eye that I'm not
seeing? Probably.
So, given 44 containers, if I need every 3rd, how can I calculate it?
The same calculation has to work with every 7th, every 11th, etc.
TIA.
|