Spread.NET 17 Formula Reference
Formula Functions / Functions T to Z / TEXTBEFORE
In This Topic
    In This Topic

    This function returns text that occurs before a given character or string.


    =TEXTBEFORE(text,delimiter,[instance_num], [match_mode], [match_end], [if_not_found])


    The function has the following arguments:




    Refers to the text you are searching within. Wildcard characters are not allowed. If the text is an empty string, it returns an empty text.


    Refers to the text that marks the point before which you want to extract.


    [Optional] Refers to the instance of the delimiter after which you want to extract the text. By default, instance_num = 1. A negative number starts searching text from the end.


    [Optional] Determines whether the text search is case-sensitive. The default is case-sensitive. You can enter one of the following:
    • 0      Case sensitive.
    • 1      Case insensitive


    [Optional] Treats the end of the text as a delimiter. By default, the text is an exact match. You can enter one of the following:

    • 0    Don't match the delimiter against the end of the text
    • 1    Match the delimiter against the end of the text


    [Optional] Refers to the value returned if no match is found. By default, #N/A is returned.


    The TEXTBEFORE function matches immediately when searching using an empty delimiter value. It returns the entire text when searching from the front (if instance_num is positive) and, empty text when searching from the end (if instance_num is negative).

    Data Types

    Returns string data.


    =TEXTBEFORE("Little red Riding Hood's red hood","red") // result is "Little"

    =TEXTBEFORE("Little red Riding Hood's red hood","red", 2) // result is "Little red Riding Hood's"

    =TEXTBEFORE("Little red Riding Hood's red hood","Red") // result is #N/A

    =TEXTBEFORE("Little red Riding Hood's red hood","Red", ,1) // result is "Little"

    Version Available

    This function is available in product version 16.0 or later.

    Note: The TEXTBEFORE function is only available in Beta Insiders builds of Excel for Office 365 currently. Hence, without the Beta Insiders build you cannot import/export the XLSX using this function from/to Excel.