What the name means | "Find one or more values in a list, depending on criteria"
| Syntax | FindIf ( InpList, OutList, Criteria, [FindSwitch], [CritOpts] )
| Description |
| Array Function | This function is an array function, returning an array of values as described in the description or narrative of this function. If you don't input as an array function (Ctrl-Shift-Enter in Excel) the first element of the array only wil be returned. Business Functions has a menu option 'Array Tools', which is helpful in expanding and collapsing array functions across ranges.
| See Also | DoIf (Operation, ListIn, [ListOut], Criteria, [CritOpts], [DefValOnErr])
|
Defaults and Values The variable(s) of this function have certain defaults and/or switch values associated with them. Click here to see more. Type of Value | Value | Description | Detail | Default(s)
| FindSwitch | 0 | First matched value, or if an array is returned, all matched values in order
| | CritOpts | 0 | Criteria are OR Criteria | Switches
| FindSwitch | 0 | First matched value, or if an array is returned, all matched values in order
| | | 1 | First matched position (starting at 1), or if an array is returned, all matched positions in order
| | | 2 | Last matched value, or if an array is returned, all matched values in reverse order
| | | 3 | Last matched position (starting at 1), or if an array is returned, all matched positions in reverse order
| | CritOpts | 0 | Criteria are OR Criteria
| | | 1 | Criteria are AND Criteria |
Range Handling and Constraints This function has range inputs that are subject to range handling procedures to help reduce input errors and increase flexibility and speed. Click here to see more. The variables affected are as follows (in order): Variable | Type of Handling | Explanation | Criteria | Trailing Blank Size (one range, and will not shorten to a range length less than 1) | If this range has trailing blanks (as opposed to zeros, a blank is a cell with nothing in it), the range will be shortened to the last non-blank element. |
FindSwitch is 0 for returning values, 1 for returning positions.
It's an array function, so it will return all matches, but if you use it a single cell like a normal function it returns just the first match. Note that well: if you use this as a normal function, you get just the value or position of the first match, whereas if you use it as an array function you get all the matched values or positions.
The Criteria is a cell or range of cells with criteria that are combined as 'OR's.
A Criteria can be a value, an inequality ('>=6), or a BF style criteria ('Mod(?,2)=0'). | BF Style Criteria
BF style criteria are similar to Excels but their behavour has been extended with the use of the '?' operator to signify the value being tested. The ways to input criteria are:
- Simple Criteria using >,<,>=,<=, <> and =. These can either be a text argument (">10") or a written in a cell that is referred to in the function ie >10. The criteria are entered in a cell as text (even if you just type in >2, Excel actually understands this internally as text), or entered directly as a text string in a function such as DoIf. You can preface with a ' or leave Excel to interpret them as text.
- Simple Values that imply an 'equals to', eg 10 written in a cell. These can be entered either as text, date or number or directly into the argument list of a function such as DoIf
- Developed Criteria, which use the value tested against in more complex ways, perhaps using Excels own functions, such as MOD(?,10)=0. In this way you can use AND() and OR(), eg AND(MOD(?,10)=0,MOD(?,3)=0). The criteria are entered in a cell as text or directly into the functions argument list, and you can preface with a ' or leave Excel to interpret them as text. The value tested against is the '?' and the function internally subsitutes the value into any place (and there can be more than one) where there is a '?'. Developed criteria do not accept cell references or range names however. Instead, you have to convert the contents of what are comparing against to text, for example, with the range names CurYear and EndYear: =DoIf(0,$P$8:$P$38,S8:S38,"and(?>"&TEXT(CurYear,"#")&",?<="&TEXT(EndYear,"#")&")")
- A List of Criteria. A range of cells is permitted as Criteria for further OR conditions (the default). So each cell represents an 'OR' condition. If you want each cell to be an AND condition, see the variable CritOpts.
|
Examples | - Preview of the FindIf example.
- The above spreadsheet can be accessed from the Quick Reference (on the Business Functions menu), on the Examples menu, or in the Business Functions\Component Examples directory
|
|