+ Reply to Thread
Results 1 to 12 of 12

How to pull values from a column, and list them in a cell

  1. #1
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    How to pull values from a column, and list them in a cell

    Hello,

    I have a small problem.

    I have a table with two columns ''no input'' and ''input''. In the column ''no input'', i have the questions that have no input (each question is in a single cell i.e typical excel), let's say for example that they are Q1, Q3, Q4 and Q5. In the column ''input'' the questions that have inputs are Q2, Q6 and Q7.

    I want in a single excel cell (outside the table mentioned above) to list the questions that have no inputs i.e. it must look like this (no necessarly of course) ''Q1, Q3, Q4, Q5''.

    Is this possible??

    Thank you!

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to pull values from a column, and list them in a cell

    Native Excel functionality has no elegant way to concatenate values from multiple cells into a single cell without using VBA.
    Is this an absolute requirement or a "would be nice"?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: How to pull values from a column, and list them in a cell

    Hello Ron,

    Well...let's say it would be very useful for the task.
    Is there a VBA that you know that can help? I am familiar with VBA coding.

    Thank you

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to pull values from a column, and list them in a cell

    Perhaps something like this....

    Please Login or Register  to view this content.
    Is that something you can work with?

  5. #5
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: How to pull values from a column, and list them in a cell

    Hello Ron,

    First of all i want to thank you for replying to this thread and for helping me.
    I am not sure how to make the code work. I will put as an attachment a small example of the work i am doing. Can you show me what to do?

    Thank you!
    Attached Files Attached Files

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to pull values from a column, and list them in a cell

    After adding the code I posted into a general VBA module in your workbook, use this formula in your worksheet:
    C1: =concattext(A2:A8)

    Using your sample data, that formula returns: Q1, Q4, Q5, Q6

    Does that help?

  7. #7
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: How to pull values from a column, and list them in a cell

    It is not working with me..

  8. #8
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to pull values from a column, and list them in a cell

    • Activate your workbook
    • ALT+F11...to open the VBA Editor
    • Insert.Module
    In the new module for that workbook...
    • Copy the code I posted
    • Paste it into the new module
    In the workbook, on any sheet...
    • Enter this in a cell:
    =concattext(...select the range of No Input cells....)
    ...so if the data is in Sheet1!A2:A10...then this is the formula: =concattext(Sheet1!A2:A10)

    Does that help?

  9. #9
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: How to pull values from a column, and list them in a cell

    Now it is working!!
    The mistake i made earlier was to write ''concattext'' instead of ''concatText''.

    Thank you very much Ron!!!

    Btw if i may ask, how did you learn to write such VBA codes? By experience? Classes? Books?
    What do you recommend me to do?

  10. #10
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to pull values from a column, and list them in a cell

    Quote Originally Posted by Naja View Post
    Now it is working!!
    Btw if i may ask, how did you learn to write such VBA codes? By experience? Classes? Books?
    What do you recommend me to do?
    • Start with whatever style of VBA book facilitates your learning.
    • Get involved in a large VBA project.
    That one is important...Large, complicated projects punish you mercilessly for any ineffecient coding approaches, guaranteeing that you learn to only produce clear, efficient, well-documented, manageable programs.

  11. #11
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: How to pull values from a column, and list them in a cell

    Is there a book that you recommend?
    The code you gave me, it took you time how much time to develop?

  12. #12
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to pull values from a column, and list them in a cell

    1) Programming books are written in a few different styles. For example, some books create a story and build on it while others may divide VBA topics into functional groupings and devote chapters to each. You may also find some good on-line tutorials/videos. Browse likely candidates for the one you think you'll learn best from. In the end, you'll learn the same information.

    2) That macro happened to take me around a minute to create.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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