Search code examples
google-sheetsgoogle-sheets-formula

How to use FILTER function to extract data from not exact matches?


In this table I've got events schedule in the first two columns (A, B) and a list of events in the other two (C, D). What I need my table to do is gather all hours of the events provided in column A - which I managed to do already with the FILTER function - it takes the title from column C, looks for it in column B and gives the hours from column A. Which works great, but only if the titles from column C are exactly the same as in column B.

A: Time B: Event / C: Event D: Times
10.00 XYZ / XYZ 10.00, 11.00
10.30 ABC / ABC 10.30, 11.30
11.00 SPECIAL: XYZ /
11.30 ABC /

So what I'm struggling with is how to make it find the hour of the event even if the title is not exactly the same as in column C. Sometimes in the schedule I need to put some extra information, before or after the title of the event. If that's of any help, these adnotations before the titles would always end with a colon (as above in the sample table) and if they're after a title they'd always be in brackets (so like XYZ (special)).

I found how to extract the title after the colons, but the formula in column D has to filter a range of cells (over 150) so making it look through each and every one row would make the formula miles long.

I don't want to put an extra column to extract the title and then make the formula look through those because the file is already heavy with sheets and formulas and takes a while to load on some of my teammates computers, so adding more formulas and data would make it even slower.


Solution

  • You may try:

    =map(D2:D,lambda(Σ,if(Σ="",,ifna(textjoin(", ",1,filter(A:A,search(Σ,B:B)))))))
    

    enter image description here