Forum Discussion

Belle2218's avatar
Belle2218
Copper Contributor
Jul 03, 2025

Excel formula

I have many different topics in many different courses in a college. some of these topics may be shared across the different courses. if there is a change in any of these share topics in one course, other courses might be affected. I would like to set a formula for column F in sheet Postgraduate to reflect the different courses that shares the same topic. How do I do that? My database is quite large, 1 programme might have 12 courses x 10+ topics and I have at least 10+ different programmes. I would need to figure out how to formulate the column shared course to show the below eg without having to do it manually. 
Column A - Course Name      Column B - Topic Code   Shared Course
ABC                                         123                                   ABC,CCC
ABC                                          233                                  ABC,BBC
ABC                                          426                                  No shared course
BBC                                          561
BBC                                          233
BBC                                          122
CCC                                          122

CCC                                          333

CCC                                           123

 

1 Reply

  • m_tarler's avatar
    m_tarler
    Bronze Contributor

    To get what you show you can use:

    =TEXTJOIN(",",,FILTER(A2&","&$A$2:$A$10,($B$2:$B$10=B2)*($A$2:$A$10<>A2),"No shared course"))

    and fill down

    If you only want to see the "other" courses then you can use:

    =TEXTJOIN(",",,FILTER($A$2:$A$10,($B$2:$B$10=B2)*($A$2:$A$10<>A2),"No shared course"))

    and fill down

    If you don't want to fill down you can use REDUCE-LAMBDA to VSTACK them all together

    =LET(names, A2:A10, codes, B2:B10,
    DROP(REDUCE("",SEQUENCE(ROWS(names)),LAMBDA(p,q,VSTACK(p,TEXTJOIN(",",,FILTER(INDEX(names,q)&","&names,(codes=INDEX(codes,q))*(names<>INDEX(names,q)),"No shared course"))))),1))

     

Resources