excelexcel-formula

Find the minimum value of a range based on presence of a substring in another range


My dataset has series of columns with the pattern

I need to aggregate the results by tag for each row - for example, the lowest-number response for all questions in the row tagged with B.

Have been asked to do this in Excel on a mac - normally I would do it in R but that's not going to work this time.

Thanks for any guidance!

Edited to add:

enter image description here

Didn't realize I could drop an image here. So, for example, I would like to be able to see that for questions tagged C, the low response was "2".


Solution

  • The formula is

    =LET(tot,SUBSTITUTE(TEXTBEFORE(TEXTAFTER(TOCOL(HSTACK($A$2:$A$3,$C$2:$C$3)),"("),")")," ",""),
    resp,HSTACK(tot,TOCOL(HSTACK($B$2:$B$3,$D$2:$D$3))),
    resp1,BYROW(resp,LAMBDA(a,TEXTJOIN(",",TRUE,TEXTSPLIT(TEXTJOIN("",TRUE,CHOOSECOLS(a,1)),,",")&"|"&CHOOSECOLS(a,2)&"%"))),
    resp2,SUBSTITUTE(TEXTJOIN("",TRUE,resp1),",",""),
    resp3,DROP(TEXTSPLIT(resp2,"|","%"),-1),
    filt,FILTER(resp3,H1=CHOOSECOLS(resp3,1)),
    minval,MIN(VALUE(CHOOSECOLS(filt,2))),
    minval)
    

    enter image description here