Forum Discussion

DashTheBomber's avatar
DashTheBomber
Copper Contributor
Jul 21, 2022

Trouble with array formula using IFERROR and Index

I am using a spreadsheet that utilizes arrays to allocate personnel to different spots based on specific criteria. However, I'm running into an issue with people in vacation   I have so far managed...
  • mtarler's avatar
    mtarler
    Jul 21, 2022

    DashTheBomber  so I saw a message pop up from another member that made a great point but then it disappeared.  I don't mean to steal someone else's work but they noticed that the ranges are different.  Here I replaced the $DA$193 with $DA$192

    =IFERROR( INDEX( ROSTER!$CX$42:$CX$192,
                     SMALL(IF( ISNUMBER(SEARCH("LEAVE",ROSTER!$DA$9:$DA$192)) 
                              ,ROW(ROSTER!$DA$9:$DA$192)),
                           ROW()-ROW($N$67)+1)),
              "")

    so the lookup/index range is from 42 to 192, the criteria range is from 9 to 192 and the row return range is from 9 to 193.  The index and the ranges inside the IF don't have to be the same length but you need to be careful and make sure it won't return an index outside the range.  The ranges INSIDE the IF() probably DO need to be the same length as it may try to increment and one of them won't have a value (i.e. if tries to go to $DA$193, the 185th element, the criteria may give an error) 

Resources