Automated optimum solution

(THIS MIGHT BE CONFUSING. YOU CAN JUST JUMP TO MODELING)
Aoa. I am a student of civil engineering and i am attempting to make a spreadsheet to help me design structural members but i am at the best a novice at programming. So any help is appreciated.
Say i need a total steel area “A” and the steel available is as 0.11, 0.2, 0.31, 0.44,0.6, 0.79, 1, 1.27, 1.56, 2.25 and 5 squared inches. Moreover if i use a single type of steel bar, i can take either even or odd number of bars but if i use multiple bars, i can have an odd number of only type of bars, the rest must be even. Odd bars are not a necessity, i can have even number of all types of bars.

MODELING:
A’ = aX + bY using two types of bars.
X or Y = [0.11, 0.2, 0.31, 0.44, 0.6, 0.79, 1, 1.27, 1.56, 2.25, 5].
a = [0,2,4,6,…,(A/0.11 rounded up to nearest multiple of 2)].
b = [0,1,2,3,4,…,(A/0.11 rounded up to nearest whole number)].
A is the area required and A’ is what i get. I want a very small difference.
For simplicity
a = [0,2,4] and
b = [0,1,2,3].

So what i need is the 10 out of the ~1500 possibilities that give me the least value of |A-A’|. Positive / negative does not matter.
I know this is a lot to ask and really appreciate your consideration and help.

This is quite an interesting spreadsheet problem that I cannot solve. On a more general note though, it sounds like you need someone to do your homework, which is a bit out of scope for a Q&A.

Hi @Ishaq,

Have you found a solution to your problem?

It sounds like this is a complicated problem that might be best addressed by someone with a background in engineering. Unfortunately I can’t sort the Ask site users by degree, but sometimes I wish that I could :slight_smile:

@Ishaq - if I understand your problem correctly you have 2 parameters and 4 variables (a, b, x, y) which vary in a certain range. Even if the number of possible values are limited, the number of possible combination is rather big.

I assume that a spreadsheet cannot handle this as you have only 3 dimensions (rows, columns and sheets or 1 sheet with a column or row)

I feel you need to create a macro with 3 - 4 loops covering dynamically the range of your parameters and variables. The macro needs to identify the combination you are looking for. A flowchart could possible help you to identify the macro structure you need.

Once you work on a macro and run into programming problems, place a question here. There are quite some macro experts around.

what-if operations in Calc can handle only 2 variables, the same as in Excel.