Common array processing functions

  • Last update:  2021-03-29
  • I. INDEXOFARRAY

    INDEXOFARRAY(array,index): Returns the index element of the array.

    array: Need to return an array of elements.

    index: The index of the array element.

    Example

    INDEXOFARRAY(["first","second","third"],2) returns "second".

    Enter =indexofarray(["a","b","c","d"],3) in the cell to get the data at the third position in the array, that is, the return value is c.

    II. INARRAY

    INARRAY(co,array): Returns the position of co in the array. If co is not in the array, it returns 0.

    co: The character whose position in the array needs to be judged.

    array: array.

    Example

    Enter =inarray("b",["a","b","c","d"]) in the cell. The position of b in the array is 2, so the return value is 2.

    Enter =inarray("e",["a","b","c","d"]) in the cell. Since e is not in the array, the return value is 0.

    III. GREPARRAY

    GREPARRAY(array, fn): The function (returns true or false) is the condition, filters this array, and finally forms a new array.

    array: array.

    fn: The condition of the filtered field.

    Example

    GREPARRAY([3,4,2,3,6,8,7],item!=3) is equal to [4,2,6,8,7].

    Enter =greparray([3,4,2,0,6,8,0], item != 0) in the cell to return a new array [3,4,2,6,8].

    IV. MAPARRAY

    MAPARRAY(array,fn): Convert the items in one array to another array.

    array(Array): The array to be converted.

    fn(Function): A function for processing array items.

    Example

    MAPARRAY([3,4,2,3,6,8,7],item!=3) is equal to [false,true,true,false,true,true,true].

    Enter =maparray([3,4,2,-3,6,8,-5],if(item>0,1,0)) in the cell, and return a new array [1,1,1, 0,1,1,0].

    V. SORTARRAY

    SORTARRAY(array): Returns the sorted array of the array.

    array: The array to be sorted.

    Note: The element types of array must be the same and must be comparable.

    Example

    SORTARRAY([3,4,4,5,1,5,7]) returns [1,3,4,4,5,5,7].

    Enter =sortarray([3,4,4,5,1,5,7]) in the cell to return a new array [1,3,4,4,5,5,7].

    Attachment List


    Theme: Report Features
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy