Forum Discussion

0ff24's avatar
0ff24
Copper Contributor
Mar 06, 2025
Solved

Match data in grid from 3 variables

I'm having a hard time writing a formula to accomplish what I'm looking to accomplish.  I have a grid of data that is somewhat odd - it's how a company has been managing their process for a long time and i can't really change it.  I'm looking to extract data automatically to better format it for reports.  The data is structured like this:

  Variable 3Variable 3Variable 3Variable 3Variable 3Variable 3
Variable 1Variable 2xxxxxx
Variable 1Variable 2xxxxxx
Variable 1Variable 2xxxxxx
Variable 1Variable 2xxxxxx
Variable 1Variable 2xxxxxx

I need to be able to search the grid to pull the data based on all three variables.  Does anyone have any thoughts on this?

Thanks!!

  • As with so much in excel there are many possibilities and depend on a few factors.  If we assume there will be 1 an only 1 possible combination of Variable 1, 2, and 3 then try something like:

    =CHOOSECOLS( XLOOKUP( in_var1 & "@" & in_var2, $A$2:$A$100 & "@" & $B$2:$B$100, $C$2:$H$100), XMATCH( in_var3, $C$1:$H$1) )

    if you just need to "search" then an alternative maybe to just turn FILTERS on and use them to filter by Var 1 and Var 2.  

    So highlight the whole table and go to DATA and click Filters (or click CTRL-SHIFT-L):

    Then you click the drop down arrows and enter in the search which values you want:

    In the example on the left I typed "name1" and notice the list drops out all the names from 2-9 and if you further select the specific "name" it will only show rows with that specific name.

    Then repeat on the second column.

6 Replies

  • m_tarler's avatar
    m_tarler
    Bronze Contributor

    As with so much in excel there are many possibilities and depend on a few factors.  If we assume there will be 1 an only 1 possible combination of Variable 1, 2, and 3 then try something like:

    =CHOOSECOLS( XLOOKUP( in_var1 & "@" & in_var2, $A$2:$A$100 & "@" & $B$2:$B$100, $C$2:$H$100), XMATCH( in_var3, $C$1:$H$1) )

    if you just need to "search" then an alternative maybe to just turn FILTERS on and use them to filter by Var 1 and Var 2.  

    So highlight the whole table and go to DATA and click Filters (or click CTRL-SHIFT-L):

    Then you click the drop down arrows and enter in the search which values you want:

    In the example on the left I typed "name1" and notice the list drops out all the names from 2-9 and if you further select the specific "name" it will only show rows with that specific name.

    Then repeat on the second column.

    • 0ff24's avatar
      0ff24
      Copper Contributor

      Thank you very much for the fast reply.  There is only one possible combination of all three variables and i need to stage the data in another location, so the formula you're presenting is ideal here.  Unfortunately, I can't seem to get the formula to function.  

      I'm assuming in_var1 can just be replaced with a field that has the desired variable response?  Not sure what else I could be missing here.

      • m_tarler's avatar
        m_tarler
        Bronze Contributor

        I had a typo, accidentally dropped the 'S' off of CHOOSECOLS

        Fixed it up above.

        If that isn't the problem are you useing Excel 365 or some old version?  If you type =CHOOSEC  do you see a tooltip / drop down that has CHOOSECOLS in it?  

Resources