+ Reply to Thread
Results 1 to 9 of 9

INDEX with column by column instead of row by column

  1. #1
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    INDEX with column by column instead of row by column

    May have to use a VLookup here, but I'm not really sure how to handle this in a VLookup. I have a few sheets that contain the same info in columns A and B. This info may not be in EVERY sheet, but I'd like Excel to look at every sheet and check. If cell A2 matches something in A:A in another sheet, AND B2 in the first sheet matches something in B:B in the second sheet, return whatever is in column C of that row. Row numbers of the same info may not match. For example, info1 may be in Row 45 of sheet1, and row 3 of sheet2, and row 500 of sheet 3 etc.

    If the INDEX function is able to do a match on two columns rather than a row and a column, that would work too. As I know it though, INDEX finds the cross of a row by column, and so right now it doesn't quite work for this application.

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: INDEX with column by column instead of row by column

    If you post a workbook with sample data it will be much easier to help you.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: INDEX with column by column instead of row by column

    This is, without exaggeration, the hardest lookup problem I've yet seen on this forum. Like, I think it's theoretically solvable with lookups, but the formula I'm imagining are... intimidating.

    How many sheets is "every sheet"? If it's more than, like, four, OR if it can change, you're pushing yourself towards using some VBA.
    Are you looking for the FIRST match or ALL matches? If it's more than the first match, you're better off doing some kind of tabling operation instead.

    Broadly, my response is this:
    1) Move the data onto one sheet, not multiple sheets
    2) Can you use a PivotTable to explore the data instead?
    --You can get away with multiple sheets if you use the PowerPivot addon

  4. #4
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: INDEX with column by column instead of row by column

    I'm with Ben. Try control + F.


    Sample data would be helpful if you can upload a sample (desensitized) version of your sheet with anticipated result
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

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

    Re: INDEX with column by column instead of row by column

    When you say "every sheet", is it really just a known certain number of sheets? That's manageable without VBA.
    When the A/B match occurs on one of your sheets, is that the only match there is? If so, that's also possibly manageable without VBA.


    To have a pair of values match against any number of other sheets AND possibly bring back multiple matches across all those sheets, that would require VBA, in my opinion.
    _________________
    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!)

  6. #6
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: INDEX with column by column instead of row by column

    UPDATE: So I thought of making three separate "helper" columns representing each of the three sheets I'm grabbing numbers from. Each helper column basically does a matching test on columns A and B, and if both criteria are met, returns the value in any designated column. Example:

    In my Helper Column (Column I) Sheet 1: =IF(COUNTA(A2:B2)=2,MATCH(A2&"_"&B2,INDEX(TESTING!$A$2:$A$5000&"_"&TESTING!$B$2:$B$5000,0),0),"")

    If the stuff in A2 matches something in my TESTING sheet column A, AND B2 matches something in the TESTING sheet column B (almost like a column by column cross reference), return a count (unique designation).

    In another column on sheet 1:

    =IFERROR(IF($I2<>"",INDEX(TESTING!$I$2:$I$5000,I2),""),"")

    If theres something in the column I (helper column for TESTING sheet), return the value in TESTING sheet Column I which matches the index of Column I (I2 in this case).

    So I'll need two more helper columns for each sheet I need to grab stuff from.
    Last edited by gaker10; 09-15-2014 at 04:45 PM.

  7. #7
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: INDEX with column by column instead of row by column

    I just saw your responses, hehe. Sorry, I actually typed up a solution to post and then I got sidetracked with work.

    @ben: There's 3 sheets of data, and a cover sheet that pulls this data from the three sheets. I cannot move the data to one sheet because it would be unmanageable for my co-workers. There's separate sheets for a reason Unfortunately, I'm not too savvy with pivot tables although I have heard a lot of testimonies about their usefulness.

    @JBeaucaire: 4 sheets total. Match only occurs once PER SHEET. If info1A is in column A of sheet 1, and info1B is in column B of sheet 1, then there will not be an info1A and info1B again on sheet 1. But, it MIGHT be in sheets 2 or 3 or 4.

    I would like to post the workbook but I'm currently testing my proposed solution with real data, some of which contains sensitive info. Let me know if you don't understand my solution and I'll indulge your curiosity if you like

  8. #8
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: INDEX with column by column instead of row by column

    That's substantially easier than I first thought.

    If there's one-and-only-one match per sheet, then you can just use SUMPRODUCT to do the matching.

    =SUMPRODUCT(--(A:A = A_in), --(B:B = B_in), ROW(A:A) )

    that will return the sum of all rows where both A & B match, which will be the matching row in a one-and-only-one scenario.

    Feed that into an INDEX and you're good:

    =INDEX(C:C, row)

    If it's three sheets, my advice is just return the matches (or errors in the case of no matches) for all three sheets.

  9. #9
    Forum Contributor
    Join Date
    06-16-2014
    Location
    United States
    MS-Off Ver
    Home 2010
    Posts
    122

    Re: INDEX with column by column instead of row by column

    I actually used a SUMPRODUCT in another similar application, and it was such a complex formula that it slowed down my whole workbook, and so I avoided it this time around But for something like this, it might work nicely.

+ 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. Vlookup but change column index number as you drag to next column
    By yankeekid86 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-29-2013, 09:46 AM
  2. Using a column number found using MATCH to act as the INDEX column field
    By dugwan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-30-2013, 07:54 PM
  3. [SOLVED] find set value in column d then get value in column a, INDEX or LOOKUP?
    By lexi521 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-22-2013, 03:17 PM
  4. Replies: 3
    Last Post: 04-10-2013, 06:33 AM
  5. Return column index number after entering two column references
    By 4am in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-28-2010, 03:33 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