+ Reply to Thread
Results 1 to 8 of 8

Finding intersection value of specific row and column that match a certain value

  1. #1
    Registered User
    Join Date
    04-03-2009
    Location
    Munich
    MS-Off Ver
    Excel 2003
    Posts
    11

    Finding intersection value of specific row and column that match a certain value

    Hi there,

    here is my problem: I have different groups of Airlines (like Lufthansa, United...) and each group contains a "table":
    - in rows are the flight classes (Q,V,T...in C3, C4, C5 for example)
    - in columns are the fidelity program (M&M, Bonus, Smiles...in D2,E2,F2)

    The intersection of each provides me the awarded mileage in % (like 50%, 75%, 100%...).

    I want to enter in A20 the Airline name, in A21 the Class, and in A22 the fidelity program...and in return I get in A23 the awarded mileage (= intersection of the Class and the fidelity program... in the right table).

    I tried the following, but it twisted my brain for too long... and I cannot resolve this anymore, somehow.

    Please Login or Register  to view this content.

    Any idea ?

    Thank you.

    Nikox

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Finding intersection value of specific row and column that match a certain value

    Please post a sample file (not image) so we have data to work with.

    To Attach a File:

    1.Click "Go Advanced"
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.

  3. #3
    Registered User
    Join Date
    04-03-2009
    Location
    Munich
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Finding intersection value of specific row and column that match a certain value

    Pls see attachment...
    Attached Files Attached Files

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding intersection value of specific row and column that match a certain value

    I think for this you need to make each airline's table a named range and then use a mixture of LOOKUP, CHOOSE, VLOOKUP or INDEX MATCH with INDIRECT. I don't immediately see any need for the OFFSET function. I'm about to log off, but will look in tomorrow to see if it has been solved.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding intersection value of specific row and column that match a certain value

    Have a look at the attached, which I have thrown together quickly. I think it does what you want.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-03-2009
    Location
    Munich
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Finding intersection value of specific row and column that match a certain value

    Hi AliGW,

    AWESOME !!! thanks so much.

    For a newbie like me, could you please explain what you did ?

    It looks to me like you are adding a"_" in the blanks of the airline words. And the INDEX function is doing nothing else than looking for the matching word in the entire sheet ? (there is no array specified...I thought INDEX needs an array).

    Then, I don't understand what is doing the MATCH function, especially with the &"_class".

    --> Does your formula tries to find the very first Airline instance selected, and then looks for the matching class row...after what you only have to add the columns corresponding to the Fidelity program ?

    (if so, since the Airline position is always 1 column after the class column, how does excel know that which column (for the class) it needs to look for ? I would have guessed, that it always look on the right of the defined position (here the Airline name)).

    Thanks again.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Finding intersection value of specific row and column that match a certain value

    As per Ali's post #4, Ali created "Named ranges" for each Airline.

    As you cannot have a blank in the name of a "named range" Ali inserted an underscore "-" so "Air China" has named range of "Air_China" and the class is named "AIR_CHINA_class". In all instances the named range (such as "AIR_CHINA") references the columns headed M&M, Bonus and Smiles

    Ali's formula:

    =INDEX(INDIRECT(SUBSTITUTE($C$21," ","_")),MATCH($C$22,INDIRECT(SUBSTITUTE($C$21," ","_")&"_class"),0),1)

    SUBSTITUTE($C$21," ","_") replaces the blank in the name in C21 with an undescore which gives the name of a named range.

    The INDIRECT is the way the named range is referenced so for C21="AIR CHINA" we get INDIRECT("AIR_CHINA"): the range used by INDEX

    MATCH($C$22,INDIRECT(SUBSTITUTE($C$21," ","_")&"_class"),0),1)

    INDEX requires a row and/or column reference so ...

    we match C22 against another range e.g "AIR_CHINA_Class" to get the row number.

    The column number of the INDEX range (e.g. AIR_CHINA) is highlighted in bold red so 1=M&M, 2= Bonus and 3=Smiles.

    An excellent solution from Ali !

    Hope this explains how this solution works.


    Just as an aside:

    The named ranges such as "AIR_CHINA" could have included the class (4 columns) rather than a separate "class" named range and the following formula used:


    =VLOOKUP($C$22,SUBSTITUTE($C$21," ","_")),2,0) for "M&M"

    =VLOOKUP($C$22,SUBSTITUTE($C$21," ","_")),3,0) for "Bonus"

    =VLOOKUP($C$22,SUBSTITUTE($C$21," ","_")),4,0) for "Smiles"

    In the above, VLOOKUP (always) finds a match with C22 in the first column of the (any) range and then returns the result from the column specified in red
    Last edited by JohnTopley; 10-20-2016 at 01:12 AM.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Finding intersection value of specific row and column that match a certain value

    @John - thanks for the detailed explanation, and yes, of course VLOOKUP would have avoided the extra named ranges!

    @Nikox - if you go to the Formulas ribbon and open the named ranges manager you will see the arrays that I set up, and the formulae use these named ranges based on what appears in the drop-down in cell C21. I did not actually reference the cell with the airline's name at all, having already defined the ranges here so that Excel knows where to look.

    Have a good look at it, step through the formulae using the evaluate option and, if you have any further questions, do please feel free to ask. Mastering the use of INDIRECT and named ranges can save you a lot of time, so I'd recommend you try to fully understand what the formulae are doing, but John has given you a pretty thorough explanation above.

    Glad to have helped!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 10
    Last Post: 09-09-2015, 10:07 AM
  2. Replies: 2
    Last Post: 10-30-2013, 12:59 PM
  3. Replies: 4
    Last Post: 02-19-2013, 02:19 PM
  4. [SOLVED] Finding an intersection
    By shannon3778 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 01-28-2013, 01:43 PM
  5. Finding the value at the intersection of a row and column
    By TheCyrusVirus in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-13-2013, 01:30 PM
  6. Finding the intersection of two trend lines.
    By kafansler in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 01-02-2013, 03:09 PM
  7. Finding intersection of two column data
    By SiaS in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-15-2012, 03:29 PM
  8. Finding intersection of columns and rows by macro
    By AuroraBorealis87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2012, 10:43 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1