+ Reply to Thread
Results 1 to 12 of 12

Return Multiple Values Using Index

  1. #1
    Forum Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Return Multiple Values Using Index

    I have a workbook set-up like stID and Name, and I am trying to write a formula that will concat all the assocated values in stID in column C and seperate by a comma so the result looks like this
    stID Name Concat
    1 Blue Blue, Blue
    1 Blue Blue, Blue
    2 Green Green
    3 Red Red, Red
    3 Red Red, Red


    I have this formula, but when I input it and hit ctrl+enter it just writes the formula in the cell. 2 questions at hand, 1) Why does this only write the formula in the cell, and 2) Will this function return the data in my desired output?

    Please Login or Register  to view this content.

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

    Re: Return Multiple Values Using Index

    Your cell may be formatted as text.
    This is an array formula, it has to be entered with Ctrl + Shift + Enter, not just Enter.
    The {} should not be typed, they will appear as a confirmation that you did use CSE.

    But I'm not sure how that formula will concatenate anything...
    <----- 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 Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Re: Return Multiple Values Using Index

    Ah-hah, removing the { } from the syntax and using ctrl+shft+entr worked, but my formula is not returning anything.

    How should this formula be altered to return the data I am after?

  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,434

    Re: Return Multiple Values Using Index

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one and nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    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 Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Re: Return Multiple Values Using Index

    Attached is a sample workbook with garbage data included. my real scan range is from A2 to B2348 so much larger than what this workbook shows.
    Attached Files Attached Files

  6. #6
    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,434

    Re: Return Multiple Values Using Index

    We can't troubleshoot your formula in that file.

  7. #7
    Forum Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Re: Return Multiple Values Using Index

    Quote Originally Posted by AliGW View Post
    We can't troubleshoot your formula in that file.

    Why is that? For example, if you input my formula above into cell F3 - my desired return result would be Green since A4 = 2 and the only value associated with 2 is Green.

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Return Multiple Values Using Index

    This would be easy to accomplish if you have Office365 subscription. That way you could use TEXTJOIN function. However, this can be done with a UDF (VBA).

    1. Copy code below
    2. Press Alt and F11 on your keyboard to open VB Editor
    3. Click on Insert and select Module
    4. Paste code into Module and close VB Editor.
    Please Login or Register  to view this content.
    then use formula:
    Enter in C2 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B C
    1 stID Name DesiredOutput
    2 1 Blue Blue, Blue
    3 1 Blue Green
    4 2 Green Red, Red
    5 3 Red
    6 3 Red
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  9. #9
    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,434

    Re: Return Multiple Values Using Index

    Why is that? For example, if you input my formula above into cell F3 - my desired return result would be Green since A4 = 2 and the only value associated with 2 is Green.
    You said you were having trouble with a formula in post #3, so I asked for a sample workbook with the intention of helping you to troubleshoot it, but there is no formula attempted in your file that I can help to troubleshoot.

  10. #10
    Forum Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Re: Return Multiple Values Using Index

    Quote Originally Posted by AlKey View Post
    This would be easy to accomplish if you have Office365 subscription. That way you could use TEXTJOIN function. However, this can be done with a UDF (VBA).

    1. Copy code below
    2. Press Alt and F11 on your keyboard to open VB Editor
    3. Click on Insert and select Module
    4. Paste code into Module and close VB Editor.
    Please Login or Register  to view this content.
    then use formula:
    Enter in C2 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B C
    1 stID Name DesiredOutput
    2 1 Blue Blue, Blue
    3 1 Blue Green
    4 2 Green Red, Red
    5 3 Red
    6 3 Red
    Is there a way to keep the colors mapped to the ID? Your solution works, but for example, it puts Green with stID 1 and Red with stID 2

  11. #11
    Forum Contributor
    Join Date
    06-18-2010
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    546

    Re: Return Multiple Values Using Index

    Quote Originally Posted by AliGW View Post
    We can't troubleshoot your formula in that file.
    So sorry - this is the formula I was attempting to use
    Please Login or Register  to view this content.

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

    Re: Return Multiple Values Using Index

    Hey, jo15765. I think the idea is that you implement that formula in your workbook with sample data, to the best of your knowledge, and post that. That way we have something to work with and it makes it much easier to help you.
    You will in many threads that this is what the forum experts ask from the threadstarter.
    Last edited by Jacc; 08-24-2017 at 07:08 AM.

+ 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] Index/Match with Multiple Criteria and Multiple return values
    By Brawnystaff in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2015, 10:27 AM
  2. [SOLVED] Match Index to return multiple values
    By ed4ed2ed in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-13-2015, 05:55 PM
  3. [SOLVED] index return multiple values
    By antho27 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-20-2013, 12:52 AM
  4. Replies: 2
    Last Post: 07-17-2012, 11:53 AM
  5. [SOLVED] How to use Index Match to return multiple values
    By pingpoeng in forum Excel General
    Replies: 2
    Last Post: 04-09-2012, 09:58 PM
  6. Using Index & Small to return multiple values
    By BHudPE in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-17-2010, 06:06 AM
  7. [SOLVED] return multiple corresponding values using INDEX
    By BubbleGum in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2006, 01:45 AM

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