+ Reply to Thread
Results 1 to 7 of 7

Formula for lookup with data varying in column

  1. #1
    Registered User
    Join Date
    06-03-2016
    Location
    United States
    MS-Off Ver
    2013
    Posts
    33

    Formula for lookup with data varying in column

    Hello,

    I am struggling to find a formula that works. I am taking data from an external source and sometimes the data will be off one column and I do not want to have to edit the raw data to find what I need. I lookup a word within a specific column and find a number based on how far away that data is from that word. It is the same distance every time except for when the raw data is off a column. I have attached an example.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Formula for lookup with data varying in column

    Based on the formulas you have, a little more explanation is needed on your end. Your current formula is matching "XX-1" and "XX-2" in column G. The first match is found, but the second match yields no results since there is no "XX-2" string in column G. Is this expected?
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Formula for lookup with data varying in column

    The function you probably want is INDEX/MATCH/MATCH

    =INDEX(table _of_values, RowNmber, ColumnNumber)


    So, I copied your table2 to another sheet so it sits in the top left of the sheet starting in A1. Then this formula tells you what value is for Team C, column XX

    =INDEX($1:$1048576, MATCH("c",$A:$A, 0), MATCH("XX",$1:$1, 0))
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    06-03-2016
    Location
    United States
    MS-Off Ver
    2013
    Posts
    33

    Re: Formula for lookup with data varying in column

    This is not expected. In a perfect world it would match XX-1 and XX-2. But since there is no XX-2 it does not return anything. I would like for it to return the value under XX for Team Two. I think the way I went about it was not the ideal way. I did not expect to have to deal with a column moving.

  5. #5
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Formula for lookup with data varying in column

    Not elegant by any means, but since you're not able to easily match on both row and column references, a brute-force array does seem to get the trick done, albeit clunky.

    Test this in J4, entered as an ARRAY FORMULA and confirmed with CTRL+SHIFT+ENTER:

    Please Login or Register  to view this content.
    Copy down to fill.

  6. #6
    Registered User
    Join Date
    06-03-2016
    Location
    United States
    MS-Off Ver
    2013
    Posts
    33

    Re: Formula for lookup with data varying in column

    Here is a better representation of my data set. It contains three tabs. There is a team name, for example the Kansas City Comets, and then players listed underneath. I would like the height and weight of the first player for each team to be listed in a table. Sometimes the team names get misaligned so there is not a set format for each one. I am running a macro through each one so I need a set formula.
    Attached Files Attached Files

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Formula for lookup with data varying in column

    Another take on INDEX/MATCH/MATCH

    J6: =INDEX($A:$G, MATCH(I6,$A:$A, 0), 3-ISNUMBER(MATCH("Height",$B:$B, 0)))
    K6: =INDEX($A:$G, MATCH(I6,$A:$A, 0), 4-ISNUMBER(MATCH("Weight",$C:$C, 0)))

+ 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. [SOLVED] Identifying varying data and moving it to a new column
    By richardwedamins in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-20-2016, 11:12 AM
  2. [SOLVED] Formula to correlate varying data in one column to varying data in another column
    By Chris_SS in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-09-2014, 07:36 AM
  3. Need to transpose one column into multiple with varying data
    By Topher77 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-21-2014, 06:06 PM
  4. Excel formula for SUM of Varying number of Rows in a Particular column
    By Manoj1551 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2011, 08:12 PM
  5. Varying column letter in a formula
    By SarBreen in forum Excel General
    Replies: 1
    Last Post: 06-08-2011, 01:00 PM
  6. If I have data for varying times in a column chart, how do I space
    By tc1967uk in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-22-2005, 02:06 PM
  7. Fill down formula using VBA to varying column lengths
    By Lee Jeffery in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 01-28-2005, 08:40 PM

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