Forum Discussion

matt0020190's avatar
matt0020190
Brass Contributor
Nov 07, 2024
Solved

Searching column cells for similar text values and summarising in another column

Hi Experts   I hope you can help here. To be honest without Macros not sure this is possible with formulas?   I attach an example workbook with my desired results from the data.   Basically we ...
  • m_tarler's avatar
    Nov 08, 2024

    so I have a couple of thoughts.  First off the example was very simple in the sense that each output was basically based on a key word.  So you could use:

    =COUNTIFS($B$2:$B$10,"*fresh*")

    to count all items with "fresh" somewhere in the topic.  you could create a column next to your output table with a list of keywords so then you could use:

    =COUNTIFS($B$2:$B$10,"*"&D2&"*")

    where D2 is the keyword "fresh" or "freshness" or whatever you want

    you can even make it an array output using:

    =COUNTIFS($B$2:$B$10,"*"&D2:D4&"*")

    you could get more fancy and have a list of possible words and use something like:

    =LET(list,TEXTSPLIT(C2," "),SUM(--(MMULT(--ISNUMBER(SEARCH(list,$B$2:$B$10)),SEQUENCE(COLUMNS(list),,1,0))>0)))

    where this will break each word in C2 up and check if it exists in each row of the inputs and then OR all those together to find how many rows have at least 1 of those key words.  In your example this procudes a wrong result for the 3rd row as "issues" is found in another line.

    there are MANY other options and roads you could go down with excel functions and could simulate your macro solution very closely if not the same.

    That all said another option is to add the Excel Labs plug-in and use the Labs GenerativeAI plugin and let an AI service help determine the results:

    =LABS.GENERATIVEAI("does """&B2&""" have to do with """&H1&"""?")

    this requires you to have an AI account and give the plug-in an access key 

     

Resources