+ Reply to Thread
Results 1 to 11 of 11

Lookup with INDEX - variable array

  1. #1
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    810

    Lookup with INDEX - variable array

    Hi,

    Attached is a sample.

    The formulae in column I are used to extract values from column C.

    However, the column named "Value", currently column C, may be in another column next month so I'd like the formulae in column I to be able to accommodate this.

    Thanks!
    Attached Files Attached Files
    Last edited by andrewc; 10-22-2015 at 11:44 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Lookup with INDEX - variable array

    Please upload the workbook and manually add the results you expect to see.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    810

    Re: Lookup with INDEX - variable array

    Thanks Richard, I've edited the post.

    Hopefully it's more clear!

    Thanks

  4. #4
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Lookup with INDEX - variable array

    Easy way, would be to use table objects.

    See attached.
    Attached Files Attached Files
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  5. #5
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    810

    Re: Lookup with INDEX - variable array

    Thanks very much!

    Is someone able please to suggest a solution that doesn't use tables?

    Thanks

  6. #6
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Lookup with INDEX - variable array

    Try this formula:

    =IF(COUNTIFS(A:A,G2,B:B,H2,C:C,"")>0,"n/a",SUMIFS(INDEX($1:$1048576,,COLUMN(INDEX($1:$1,MATCH("Value",$1:$1,0)))),A:A,G2,B:B,H2))


    See 'Another way' on attached file.


    p.s..... why avoid tables?
    Attached Files Attached Files

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Lookup with INDEX - variable array

    As long as the column with the values has "Values" as a header, this will accommodate the values being in different columns. Only one column header can have Values as the header.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    A
    B
    C
    D
    E
    F
    G
    H
    I
    1
    Product Country Value Product Country Value
    2
    AAA Belgium
    12
    AAA UK
    8
    3
    BBB Belgium
    15
    BBB UK
    0
    4
    CCC Belgium
    17
    CCC UK
    0
    5
    AAA UK
    8
    6
    BBB UK
    7
    CCC UK
    0
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  8. #8
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Lookup with INDEX - variable array

    To my point about tables - I realize that using the tables seems odd at first, as you don't absolutely need them to get by. HOWEVER the real usefulness of the tables is that anytime you need to reference the data they contain, anywhere in the project, you can do so by name. This is enormously helpful when you start designing more and more parts of the project, but it's really handy when you have to look over another persons design, or even your own work later on when it's not fresh in your mind.


    NON-Table Formula -- It's not terrible, but it's a mouthful. If you read it out loud it means nothing (until you track down all the references).
    Please Login or Register  to view this content.
    Table way -- Now, try reading this out loud... sounds better.
    Please Login or Register  to view this content.
    Now - Go 'whole hog' with it. Rename the tables, and use them in BOTH places (I mean in the summary and the dataset) NOW you can really see what you are doing when you read through it
    Please Login or Register  to view this content.
    You only need to know a couple of key points: When you see a table name with a header in brackets like this, T_RawData[Product] , you are referencing the entire data column under the header. WHen you see the @ symbol inside the brackets, you are referencing the value under the header on the same row as the formula cell (so, just that one row - not the whole set).

    :D

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Lookup with INDEX - variable array

    Hi,

    One way would be then following array formula in I2
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This will adapt to accommodate the varying position of the Value column. Just make sure the index range A:E in the formula is wide enough

    However don't ignore the more obvious pivot table option. It took me about 30 seconds to create a pivot table of your data.

  10. #10
    Forum Contributor
    Join Date
    02-08-2005
    MS-Off Ver
    Microsoft 365
    Posts
    810

    Re: Lookup with INDEX - variable array

    Thank you all - very helpful!

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Lookup with INDEX - variable array

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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: 4
    Last Post: 05-19-2015, 08:42 PM
  2. Can I make the row lookup array/range part in an array formula variable?
    By OLLY-7 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-18-2014, 09:06 AM
  3. Replies: 6
    Last Post: 04-30-2014, 02:42 AM
  4. Dynamic or Variable Lookup array in INDEX, MATCH or VLOOKUP
    By kishor_c in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-16-2012, 09:46 AM
  5. Replies: 2
    Last Post: 11-05-2011, 03:26 PM
  6. Replies: 7
    Last Post: 06-19-2011, 12:51 PM
  7. Set VBA Variable with Index/Match Array
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2010, 11:36 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