Hi kcc
Thanks for your help
It took me a while to get my head around it, but I think I can see what
you're doing now after applying it to the whole table (100 x 100 entries).
You're right about my logic! - I need to alter it to return the closest
match with the lowest aspect ratio that fits within the height constraint.
Basically, this means isolating all of the rows that fall within the max
height constraint, then finding the leftmost value within those rows that is
greater than the required diameter. The corresponding row and column are the
answers... I think!
I'll give it a go!
Thanks again
Andy
"kcc" <(E-Mail Removed)> wrote in message
news:nJCdnasiHJMl1AbeRVn-(E-Mail Removed)...
> This is a bit messy, but it should work. It would require that
> the lower left triangle that is now blank be filled with zeros.
> I am also making what is potentially a big assumption, that the
> width index and height index are the same so that I can
> assume that if there are multiple match, the one in the highest
> row number is closest to the desired 1:1 ratio.
> I've put the width index in G10:P10, height in F11:F20 so that
> the first table entry of 110 is in G11.
> C1=The desired circular size (Input)
> C2=Maximum Height (Input)
>
> A11=IF(HLOOKUP($C$1,G11:P11,1)=$C$1,$C$1,INDEX(G11:P11,1,MATCH($C$1,G11:P11)+1))
> and copy down.
> A11 is the best match for the given row.
> B11=IF(ISERR(A11),10^10,IF(F11>$C$2,10^10,A11-$C$1)) and copy down.
> B11 is difference between the desired n1 and the closest value, with 10^10
> if > max height or no match.
> C11=MATCH(A11,G11:P11) and copy down.
> C11 tells which column matches the found value
>
> C3=MIN(B11:B19) is the error in the closest match
> C4={MAX(IF(B11:B19=C3,ROW(B11:B19)-ROW(B11)+1,0))} largest row matching C3
> (array formula)
> C5=INDEX(C11:C19,C4) column of match
> C6=INDEX(F11:F19,C4) Height of answer
> C7=INDEX(G10:P10,C5) Width of answer
>
> If the assumption is wrong you would have to add a column of
> ratios for the closest match and find the min. Some additional
> error checking should be added. This returns errors or the
> biggest height if the is no match.
>
> Not really understanding your work, I may be way off base, but
> I do wonder if the closest match to n1 is really the best first criteria.
> For instance if n1 is 185, the answer is 100 x 300.
> However, 175 x 175 allows more flow at 193 and requires less
> material with a perimeter of 700 vs 800.
>
> kcc
>
>
> "Andy Sandford" <(E-Mail Removed)> wrote in message
> news:dncrgr$8lq$1$(E-Mail Removed)...
>> Hi All
>>
>> I have a formula that converts the diameter of a circular duct into it's
>> equivalent rectangular counterpart. This formula is used to populate a
>> table, a section of which is detailed below:
>> Width
>> 100 125 150 175 200 225 250 275 300 325
>> 100 110 123 134 145 154 163 171 178 185 217
>> H 125 138 151 162 173 183 192 201 209 240
>> e 150 165 178 190 201 212 222 231 260
>> i 175 193 206 218 230 240 251 279
>> g 200 220 234 246 258 269 297
>> h 225 248 261 274 286 313
>> t 250 275 289 301 329
>> 275 303 316 344
>> 300 330 358
>>
>> The top row of the table is the width of the rectangular duct, the left
>> hand column is the height.
>> The cells within the body of the table are the circular duct equivalents.
>>
>> e.g. The rectangular equivalent to a circular duct of diameter 201mm is
>> therefore either 275mm x 125mm OR 225mm x 150mm
>>
>> I need to search the body of the table for the closest match to a given
>> diameter (n1) and return the numbers in the corresponding top row and
>> left-hand column (width and height).
>>
>> I need to return a single result based on the following constraints:
>>
>> 1) The initial circular match in the table needs to be equal to OR higher
>> than n1.
>> 2) The height of the rectangular element needs to be less than or equal
>> to a specified value (h).
>> 3) The ratio of width to height needs to be as close to 1:1 as possible.
>>
>> e.g. Required circular duct diameter (n1) = 233mm, Maximum height of
>> equivalent rectangular duct (h) <= 175mm
>>
>> Closest selection in the body of the table is 234mm, but this does not
>> meet point (2) maximum height (h)
>>
>> The next nearest selection is 240mm, but this occurs twice.
>>
>> Based on aspect ratio, point (3), the best solution is therefore 275mm
>> wide by 175mm high (1:1.57), rather than 325mm x 125mm (1:2.60).
>>
>> I hope I've given you guys enough info.
>>
>> Thanks to you all in advance!
>>
>> Andy
>>
>>
>
>
|