+ Reply to Thread
Results 1 to 5 of 5

Returning multiple values

  1. #1
    Registered User
    Join Date
    01-14-2017
    Location
    Scotland
    MS-Off Ver
    2016
    Posts
    2

    Returning multiple values

    Hi there, was wondering if anyone would be able to give me a hand with a function I am using. Here it is below:

    Please Login or Register  to view this content.
    This nested function basically looks up a name on a different sheet and returns multiple values attached to that name, however it only works if the two columns are next to each other.

    I would greatly appreciate if anyone could spread some light on how I could look up this name and return a value from a column that is far away from that, for example return values from A instead of D or E.

    Thank you very much for any assistance.

  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: Returning multiple values

    Normally the answer is to use a combination of INDEX(MATCH()) functions. However it's a little difficult to advise further without seeing the workbook.

    However, and assuming your data is in a normalised two dimensional table then you'll probably find a Pivot Table will provide an answer and avoids needing a function altogether.
    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 Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning multiple values

    Quote Originally Posted by Threadsheet View Post
    =IF(ISERROR(INDEX(Activities_export!$D$1:$E$97,SMALL(IF(Activities_export!$D$1:$E$97=$G$2,ROW(Activities_export!$D$1:$E$97)),ROW(1:1)),2)),"",INDEX(Activities_export!$D$1:$E$97,SMALL(IF(Activities_export!$D$1:$E$97=$G$2,ROW(Activities_export!$D$1:$E$97)),ROW(1:1)),2))
    Just index the column that you want to extract the data from.

    Also, if you're using Excel 2007 or later you can reduce the formula length by half using the IFERROR function.

    Here's a small example:

    Data Range
    A
    B
    C
    D
    E
    1
    Region
    Value
    ------
    Region
    Value
    2
    South
    40
    North
    46
    3
    North
    46
    74
    4
    West
    5
    2
    5
    North
    74
    23
    6
    South
    22
    7
    West
    6
    8
    North
    2
    9
    West
    49
    10
    West
    39
    11
    North
    23
    12
    East
    36
    13
    East
    75
    14
    South
    29
    15
    South
    3


    This array formula** entered in E2:

    =IFERROR(INDEX(B:B,SMALL(IF(A$2:A$15=D$2,ROW(A$2:A$15)),ROWS(E$2:E2))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    01-14-2017
    Location
    Scotland
    MS-Off Ver
    2016
    Posts
    2

    Re: Returning multiple values

    Thanks for the replies guys.

    Tony that function worked for what I wanted and made my first one a lot cleaner, thanks a lot!

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Returning multiple values

    You're welcome. Thanks for the feedback!

+ 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] Vlookup multiple criteria returning multiple values
    By ykobure in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-16-2015, 07:28 AM
  2. Index across multiple sheets returning multiple values
    By Joak in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-22-2014, 11:59 AM
  3. Index across multiple sheets returning multiple values
    By Joak in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-21-2014, 11:15 AM
  4. [SOLVED] Two criteria Index Match on multiple sheets returning multiple values
    By Joak in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-21-2014, 10:03 AM
  5. Returning multiple values in multiple cells based upon one input
    By ccoonsk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2012, 10:01 AM
  6. Replies: 6
    Last Post: 03-24-2011, 06:19 AM
  7. Replies: 2
    Last Post: 05-05-2010, 06:01 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