I have a complicated expression that I'd like to set a lower bound to.
The value should never dip below 34.
The only working solution I've found is:
Let f(x) be the expression used to calculate the value.
To include a lower bound I've been doing "=IF(f(x) < 34, 34, f(x))"
This works well when f(x) is simple but this explodes in length as the length of f(x) increases.
If I wanted to also include an upper bound of 50 I would need to write the expression as
"=IF(f(x) < 34, 34 IF(f(x) > 50, 50, f(x)))"
I've tried the Min function but it just remains blank.
"=Min(Array(5,7))" does not return 5
For context here is the expression I created to calculate the proper zoom level for a static google map.
Please note that these formulas are generated by another program I created to help me manage the complex calculations I need to do. There is no way I would ever try to manage these manually. Currently, there are 30 pins being managed and my boss is thinking about increasing this to 90.
Floor(IF(LOG(((((Parameters.PixelHeight)/2-(Parameters.Buffer))*Parameters.Pi/64))/ABS((LOG((1+(SIN((Max(X_COORD))*(Parameters.Pi)/180)))/(1-(SIN((Max(X_COORD))*(Parameters.Pi)/180))))/LOG(EXP(1)))-(LOG((1+(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180)))/(1-(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180))))/LOG(EXP(1)))))/LOG(2) < LOG(((((Parameters.PixelWidth)/2-(Parameters.Buffer))*360/256))/(Max(Y_COORD)-((Max(Y_COORD)+Min(Y_COORD))/2)))/LOG(2), LOG(((((Parameters.PixelHeight)/2-(Parameters.Buffer))*Parameters.Pi/64))/ABS((LOG((1+(SIN((Max(X_COORD))*(Parameters.Pi)/180)))/(1-(SIN((Max(X_COORD))*(Parameters.Pi)/180))))/LOG(EXP(1)))-(LOG((1+(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180)))/(1-(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180))))/LOG(EXP(1)))))/LOG(2), LOG(((((Parameters.PixelWidth)/2-(Parameters.Buffer))*360/256))/(Max(Y_COORD)-((Max(Y_COORD)+Min(Y_COORD))/2)))/LOG(2)))
Which has to be reused when I need to determine the position of a pin in my report.
200+256*POW(2,(Floor(IF(LOG(((((Parameters.PixelHeight)/2-(Parameters.Buffer))*Parameters.Pi/64))/ABS((LOG((1+(SIN((Max(X_COORD))*(Parameters.Pi)/180)))/(1-(SIN((Max(X_COORD))*(Parameters.Pi)/180))))/LOG(EXP(1)))-(LOG((1+(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180)))/(1-(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180))))/LOG(EXP(1)))))/LOG(2) < LOG(((((Parameters.PixelWidth)/2-(Parameters.Buffer))*360/256))/(Max(Y_COORD)-((Max(Y_COORD)+Min(Y_COORD))/2)))/LOG(2), LOG(((((Parameters.PixelHeight)/2-(Parameters.Buffer))*Parameters.Pi/64))/ABS((LOG((1+(SIN((Max(X_COORD))*(Parameters.Pi)/180)))/(1-(SIN((Max(X_COORD))*(Parameters.Pi)/180))))/LOG(EXP(1)))-(LOG((1+(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180)))/(1-(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180))))/LOG(EXP(1)))))/LOG(2), LOG(((((Parameters.PixelWidth)/2-(Parameters.Buffer))*360/256))/(Max(Y_COORD)-((Max(Y_COORD)+Min(Y_COORD))/2)))/LOG(2)))))*(((Item(1,AllValues(Y_COORD)))+180)/360) - 256*POW(2,(Floor(IF(LOG(((((Parameters.PixelHeight)/2-(Parameters.Buffer))*Parameters.Pi/64))/ABS((LOG((1+(SIN((Max(X_COORD))*(Parameters.Pi)/180)))/(1-(SIN((Max(X_COORD))*(Parameters.Pi)/180))))/LOG(EXP(1)))-(LOG((1+(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180)))/(1-(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180))))/LOG(EXP(1)))))/LOG(2) < LOG(((((Parameters.PixelWidth)/2-(Parameters.Buffer))*360/256))/(Max(Y_COORD)-((Max(Y_COORD)+Min(Y_COORD))/2)))/LOG(2), LOG(((((Parameters.PixelHeight)/2-(Parameters.Buffer))*Parameters.Pi/64))/ABS((LOG((1+(SIN((Max(X_COORD))*(Parameters.Pi)/180)))/(1-(SIN((Max(X_COORD))*(Parameters.Pi)/180))))/LOG(EXP(1)))-(LOG((1+(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180)))/(1-(SIN(((Max(X_COORD)+Min(X_COORD))/2)*(Parameters.Pi)/180))))/LOG(EXP(1)))))/LOG(2), LOG(((((Parameters.PixelWidth)/2-(Parameters.Buffer))*360/256))/(Max(Y_COORD)-((Max(Y_COORD)+Min(Y_COORD))/2)))/LOG(2)))))*((((Max(Y_COORD)+Min(Y_COORD))/2)+180)/360)