As promised in the previous post, I will now look in more detail at the process for automating the Excel Goal Seek function with the RC Design Functions spreadsheet, to calculate reinforcement area or section depth for a range of bending moments and associated axial loads.

The example shown in the screen shot below finds the minimum reinforcement required for an arch structure with a range of positive and negative bending moments and varying axial load.

The input ranges are shaded grey for the cross section data, and light blue for the Goal Seek data. The section data input is in the usual format for the EStress and UMom functions. Note that in adjusting the reinforcement area the functions use the bar diameter entered in the section data, and in effect change the number of bars.

The data required by the Goal Seek routine is:

- The addresses of the “target range” (taddr) and the “by changing range” (aaddr)
- The “Goal Value” (GVal) and lower and upper bounds on the absolute value of the Goal (MinAbs and MaxAbs)

Note that the required range names are already set up on the GoalSeek examples sheet, but the Goal Seek routine may be used on any other sheet by creating the same four names, with Worksheet scope. Also note that the addresses in cells F20 and F21 are generated with a formula, using the data in B20:D21, but if you prefer you can simply type the required range addresses in F20:F21.

The axial force and moment on each section are entered in Columns B and C, followed by the section depth, and top and bottom steel areas in Columns D to F.

Note that the data that will be adjusted by Goal Seek must be in a single column (Column G in this case). Because the section bending moments may be either positive or negative, Columns E and F contain simple formulas returning either the area in Column G if the steel will be in tension, or the minimum steel area entered in E25 if it is in compression:

- Column E: =IF($C29<0,$G29,$E$25)
- Column F: =IF($C29>0,$G29,$E$25)

The steel stress is calculated for the top and bottom steel in Columns H and I, with the maximum absolute value in Column J, and the ratio to the Target Stress in Column K. It is Column K that will be adjusted to the target value (1.0) by Goal Seek:

The steel stresses are calculated by the EStress function, with input as shown below:

Note that the full columns of axial loads and moments are entered as the Axin and Momin arguments. The output is controlled by the Out1 and Out2 arguments. Out1 = 1, for stress, and Out2 = 2 for top steel (column I) or 3 for bottom steel (Column J).

The section depth and steel areas are defined in Columns D to F, as shown below:

Input for the bottom steel stress is the same as the top steel, except that Out2 =3:

Note that the functions will return a column of results, covering the length of the input data ranges, and must be entered as an array function, to return all the needed values:

Initially the tension steel area should be entered as the minimum allowable area:

Then click the “Run Goal Seek” button, and the reinforcement areas will be adjusted, so that the stress ratio is equal to or greater than 1:

The resulting graph of reinforcement stress shows a maximum tension of 250 MPa:

A similar process can be followed for ultimate moments, using the UMom function, and resetting the addresses of the Target cells and By Changing Cells:

The resulting moment capacities are equal to or greater than the applied bending moments:

The section depth may also be adjusted, to match either a target stress, or moment capacity, as shown below:

In this case the reinforcement area is kept constant, so the reinforcement details entered in the main Section Details range are used, and the range for the adjustable section details may be limited to a single column, containing the adjustable section depth.

To carry out a similar analysis on a different sheet:

- Set up a similar table to those shown above, with a single column for the Target values, and a single column for the By Changing values.
- Create named ranges with “Worksheet” scope with the names: “taddr” (target values), “aaddr” (by changing values), “GVal” (goal value) and “MinAbs” and “MaxAbs” (minimum and maximum values for the targets).
- Create a button for the GSeekA macro, or press Alt-F8 and select GSeekA.

Great post Doug! Here’s my small offer on using Goal Seek with VBA : http://bit.ly/1P9JlXm

LikeLike

Thanks Winston.

I recommend a read of the link to anyone interested in using Goal Seek with VBA, and using Microsoft documentation in general.

LikeLike

it is a very useful spreadsheet. it is surprising what can be done with excel and vba..

i am developping my own spreadsheet based on the spanish code thanks to your ideas….i never tought of using data ranges as input for a function…

thanks….

LikeLike

I’d like to use horizontal range for input data (section properties, etc) in UmomPF function but I get argument error. Vertical range works well. I try to use Excel’s “TRANSPOSE” function to reverse horizontal range but it doesn’t work. Can you help?

LikeLike

I don’t know why using Transpose inside the function doesn’t work, but it seems that it passes a single value of 40, rather than the transposed array. I don’t know where the 40 came from as the first value in my data was 1000. Very strange.

The simplest workaround would be to use the transpose function on the spreadsheet, and use the transposed range in the function.

Alternatively, if you are happy working with VBA, you could add the following line to he UMomPF code, just after incells = UMomin.Value2:

If UBound(incells) < UBound(incells, 2) Then incells = WorksheetFunction.Transpose(incells)

That seems to work OK.

It would be fairly simple to add something similar to all the functions, so I'll look at doing that in the next few days.

LikeLike

Now it works with additional VBA if statement. Thanks for quick ansewer and solution!

LikeLike

Is there any simple way in Excel to join two ranges into one when using UDF? I’m looking something similar to VBA UNION method. I would like to join two ranges for “input range” argument in Estress fucntion. The first range will be RC sections properties same as for UmomPF function and second – rest of needed arguments of “input range”.

LikeLike

The simplest way would be to set up your input ranges the way you want, then combine them into a single range on the spreadsheet.

If you want to do it in VBA you could write a simple front end function to combine the data into a single array, then call Estress from VBA. I have never actually used the VBA Union method, so I’d create the combined array by just looping through each of the input ranges, but I’ll have a look at the Union method, it sounds like it should be useful.

LikeLike