I would like a Google Sheet formula that returns any cell that starts with a string.
This is for a school timetabling system where the syntax is ClassCode(YearYear/SubjectSubject/ClassClassClass), room and then the teacher as follows
08SC101 @ T201 (Valerie FRIZZLE (Year 08 SCience class 101 taught by Valerie Frizzle).
The database is in a seperate sheet called CLASSES and each column is a single class period (Ie. CLASSES!A:A is Monday Period 1, CLASSES!B:B is Monday Period 2 etc.)
Let’s suppose the database is as such for Monday Period 1 CLASSES!A:A
07HI101 @ B107 (Ashley HARRISON
07HI102 @ B108 (Emily CAREY
08SC101 @ T201 (Valerie FRIZZLE
08SC102 @ T202 (Lisa GRAY
I would like the output to be if the condition was class codes starting in ’08’ to be
08SC101 @ T201 (Valerie FRIZZLE
08SC102 @ T202 (Lisa GRAY
I have tried =FILTER(CLASSES!A1:A99,ISNUMBER(SEARCH("08",CLASSES!A:A))) for class codes that start with ’08’ however it is wildcard to the extent it also returns any cell that includes ’08’ that including rooms. The output would be
07HI102 @ B108 (Emily CAREY
08SC101 @ T201 (Valerie FRIZZLE
08SC102 @ T202 (Lisa GRAY
What other approaches are there to acheveing the correct result?
Many thanks 🙂
>Solution :
You could do some approach with REGEXMATCH also, but since you already wrote a SEARCH statement inside FILTER, you could use it to check if the result of SEARCH is 1 (meaning it’s at the beginning):
=FILTER(CLASSES!A1:A99,SEARCH("08",CLASSES!A1:A99)=1)