问题
I have a problem with a dynamic list in Excel 2003 where some cells that I want to be empty are returning #NUM!
. I have tried manipulating the following code, but to no avail:
=IF(ISERROR(INDEX(venue_name, SMALL(IF(($A$10=date_ns)*(COUNTIF($A$13:A29,venue_name)=0), ROW(date_ns)-MIN(ROW(date_ns))+1, ""), 1)))
I know its something to do with syntax/parentheses but have exhausted myself trying different combinations. Without the IF(ISERROR(
and the closing bracket, the code runs absolutely fine.
回答1:
To use ISERROR you'd have to repeat the whole formula normally but presumably error is caused by an insufficient number of matching criteria so try this version in A14:
[Revised simpler version]
=IF(SUM(($A$10=date_ns)*(COUNTIF($A$13:A13,venue_name)=0)),INDEX(venue_name,MATCH(1,($A$10=date_ns)*(COUNTIF($A$13:A13,venue_name)=0),0)),"")
confirmed with CTRL+SHIFT+ENTER and copied down
....or you can use this version which doesn't need CTRL+SHIFT+ENTER
=IF(SUMPRODUCT(($A$10=date_ns)*(COUNTIF($A$13:A13,venue_name)=0)),INDEX(venue_name,MATCH(1,INDEX(($A$10=date_ns)*(COUNTIF($A$13:A13,venue_name)=0),0),0)),"")
see sample file here
回答2:
Seems to have been superseded by events but considering =ISERROR, as the maestro has said “you’d have to repeat the whole formula normally”. (Not necessary in later versions of Excel that have =IFERROR). Hence:
=IF(
ISERROR(
INDEX(venue_name, SMALL(IF(($A$10=date_ns)*(COUNTIF($A$13:A17,venue_name)=0), ROW(date_ns)-MIN(ROW(date_ns))+1, ""), 1))
)
,"",
INDEX(venue_name, SMALL(IF(($A$10=date_ns)*(COUNTIF($A$13:A17,venue_name)=0), ROW(date_ns)-MIN(ROW(date_ns))+1, ""), 1))
)
the third and sixth lines (INDEX ...) are the 'working formula'. The first, fifth and last are the =IF condition (where a blank result is assumed to be required if TRUE). The second and fourth lines are the =ISERROR, which returns TRUE if an error is found (as a result of the 'working formula') and FALSE otherwise.
Could be represented as: =IF(error in working formula, blank, working formula).
来源:https://stackoverflow.com/questions/18229540/wrapping-if-iserror-around-index-function