Search code examples
regexgoogle-sheetsfiltertransposegoogle-query-language

Select cell in Google Sheets where cell begins with specific character


I have a range of cells B5:I5, and I need to select the cell which starts with 'R'. Tried with query, but can't the result.

Could somebody help please?


Solution

  • try:

    =FILTER(B5:I5; REGEXMATCH(B5:I5; "^R.+"))
    

    or:

    =TRANSPOSE(QUERY(FLATTEN(B5:I5); "where Col1 starts with 'R'"))
    

    or:

    =TRANSPOSE(QUERY(FLATTEN(B5:I5); "where Col1 matches '^R'"))