COLUMN() problem with array formula

E

ejack

I am having a problem error proofing this formula. The formula as listed
successfully takes a heading and concatenates some text onto it and then goes
into a second detail sheet. It takes the value in column RC5 which is the
highest “All: Net Profitâ€, finds those values (possible multiple high values)
in the “All: Net Profit†detail column, then selects the minimum value in the
column with the desired heading. When the column does not exist in the
second sheet a #NA is returned.

{=IF(RC5="","",MIN(IF(INDIRECT("'"&RC2&"'!r2c"&MATCH("All: Net
Profit",INDIRECT("'"&RC2&"'!r1",FALSE),0)&":r8001c"&MATCH("All: Net
Profit",INDIRECT("'"&RC2&"'!r1",FALSE),0),FALSE)=RC5,INDIRECT("'"&RC2&"'!r2c"&MATCH(INDIRECT("R2C"&TRUNC((COLUMN()-1)/7)*7+1,FALSE)&"
("&R1C1&")",INDIRECT("'"&RC2&"'!r1",FALSE),0)&":r8001c"&MATCH(INDIRECT("R2C"&TRUNC((COLUMN()-1)/7)*7+1,FALSE)&"
("&R1C1&")",INDIRECT("'"&RC2&"'!r1",FALSE),0),FALSE))))}

I am trying to trap the #NA by inserting this IF before the MIN.

IF(ISNA(MATCH(INDIRECT("R2C"&TRUNC(COLUMN()/7)*7+1,FALSE),'302b'!R1,0)),"",

In my thinking this should return a blank if the column heading is not
matched. On a non-array it works and returns a blank. However, when the
array braces are added, the else clause is always executed. The exact
failure is the COLUMN() function when used in an array formula. It is needed
to operate correctly as an array because the remainder of the formula is an
array.

For testing I have minimized the problem to this formula. When the heading
does not exist, this returns “na†only as a non-array formula. It does not
return "na" as an array formula.

{=IF(ISNA(MATCH(INDIRECT("R1C"&COLUMN(),FALSE),'302z'!R1,0)),"na","ok")}

Without the COLUMN() it returns “na†with or without being an array (as it
should if the heading does not exist in the detail sheet).

{=IF(ISNA(MATCH(INDIRECT("R1C2",FALSE),'302z'!R1,0)),"na","ok")}

TEST CASE
Sheet 1
Switch,Head1
302z,{formula}

Sheet 302z
Head0,Head3

ERROR.TYPE function yields the same results.
=IF(ERROR.TYPE(MATCH(INDIRECT("R1C"&COLUMN(),FALSE),'302z'!R1,0))=7,"na","ok")

ISERROR always yields "na" as an array, even when the heading exists in the
detail sheet. It does work correctly as a non-array function.
=IF(ISERROR(MATCH(INDIRECT("R1C"&COLUMN(),FALSE),'302z'!R1,0)),"na","ok")

Any suggestions would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top