FIND
Where a text first appears in another, case counting, from a start position; a value of your choice, or an error, when it doesn't.
Group: Text. Compatible with DAX.
Syntax
FIND ( <find_text>, <within_text> [, <start_num>] [, <NotFoundValue>] )
| Parameter | Type | Description |
|---|---|---|
find_text | Text | What to look for. |
within_text | Text | The text to look in. |
start_num | Whole number optional | The character to start looking from; 1, the first, when left out. |
NotFoundValue | Value optional | What to return when the text is not there, often 0 or BLANK (). Left out, that is an error. |
Returns
Whole number. The position of the first character of the match, counting from 1.
Remarks
- Upper and lower case count, and
*and?are ordinary characters.SEARCHignores case and takes them as wildcards. - The position counts from the start of the text, wherever the search began.
- When the text is not found and no NotFoundValue is given, the result is an error: give one whenever a missing text is possible.
- A start below 1 is an error; a start past the end finds nothing.
- An empty find_text is found at position 1.
Examples
Case counts
plant is found at the 8th character; Plant is not there, so the NotFoundValue 0 comes back.
EVALUATE
ROW (
"Small p", FIND ( "plant", "Bergen plant" ),
"Capital P", FIND ( "Plant", "Bergen plant", 1, 0 )
)
| Small p | Capital P |
|---|---|
| 8 | 0 |
Starting further in
EVALUATE
ROW (
"From the start", FIND ( "s", "Mississippi" ),
"From the 5th", FIND ( "s", "Mississippi", 5 )
)
| From the start | From the 5th |
|---|---|
| 3 | 6 |
The text before a dash
EVALUATE
ROW ( "Shop", LEFT ( "Oslo-2026", FIND ( "-", "Oslo-2026" ) - 1 ) )
| Shop |
|---|
| Oslo |