+ Reply to Thread
Results 1 to 13 of 13

Populate columns in one sheet based off of a few lists in a different sheet

  1. #1
    Registered User
    Join Date
    04-25-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Populate columns in one sheet based off of a few lists in a different sheet

    Hi,

    This is my first post. However, I'm a longtime viewer.

    I've spent quite some time trying to figure out the best way to approach my Excel problem.

    The objective:

    I would like to take at least 2 lists in a "Setup" sheet (it could be more lists later) and have them 'auto populate' cells in other columns in another sheet, "Results"(same workbook).

    Example:

    One list would have a number of questions (like a survey - for example, they are formated Q1_1_1, Q1_2_1, etc) and the other list would be of countries (for example, Brazil, India, China, Chile, etc). I need the list of questions to populate one column of the "Results" sheet. It would need to do that for every country listed in "Setup". I also need it to 'auto populate' the country in the column next to the questions in the "Results" sheet. It would be replicating the same list over and over for each country listed.

    I want the users to be able to paste in their long list of questions in one column in "Setup" and their list of countries in another column, also in "Setup". That way the "Results" sheet columns will auto populate everytime with the appropriate questions and countries. Its important to note that the number of questions and the tags assigned to the questions can change. The list of countries will also be changing.

    I know the quick and easy way is to simply copy and paste the list of questions and drag the countries down. But I'm convinced Excel can do this for me - I don't want people getting lazy or tired and messing things up.

    If I have broken any forumn rules, please know that I did not intend to. Thank you for your help!!

    Jim
    Last edited by jimadaly; 05-02-2012 at 11:01 AM.

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

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook. Make sure the workbook demonstrates your desired results if possible, or just highlight the cells you're trying to fix.
    _________________
    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!)

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    could u upload a sample sheet for us to work on?

  4. #4
    Registered User
    Join Date
    04-25-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    Let me know if the file comes through ok.

    Thanks!
    Sample - Passport Survey - Annual Study 2011 JD-5-1.xlsx

  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: Populate columns in one sheet based off of a few lists in a different sheet

    I eliminated the array functions on the Setup sheet to improve performance somewhat. The massive number of arrays functions still remaining on the Results sheet mean this workbook is still a bit of a dog. I believe it can be improved further if you explain exactly what one full row of data is actually collecting, those array+indirect functions might be rewritten to speed things up more.

    Meanwhile, this accomplishes your original goal, too.

  6. #6
    Registered User
    Join Date
    04-25-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    Hi Jerry,

    Wow! I'm impressed. Seriously.

    I know there has to be a better way to do those other lookups. That was the only way I could figure out with my knowledge and reviewing forums

    Cell E2 (Respondents): That formula is to calculate the total number of responses that are 0 (zero) and above. If its blank, it doesn't count. That goes to Passport Survey - Annual Study sheet to look at one Q2_1_1 (for example) column for one country.

    Cell F2 (LongLegendValue1): That formula checks cell C2 to see what question its on. For example Q2_1_1. It looks that up in the Passport Survey sheet using an HLOOKUP. It gathers the column letter that is calculated in row 2 in that sheet. That letter is added using an INDIRECT to give the array a range to use. Since Passport Survey sheet needs to be 'searched' by column, thats what I did (very crude). It is also COUNTing the occurence of the various numbers. So it is taking the COLUMN that the current cell is in and subtracting 5 for the 5 columns before the LongLegendValue section. That gives it the LongLegendValue# to calculate. It takes that COUNT of that particular number and divides it by the number of responses. That gives us its share of the total respondents. I then just drag that formula across the rest of the row and it adjusts the COLUMN reference to change the value its looking up in Passport Survey, column L for example.

    I hope that all makes sense. It made sense in my head... hah. It 'works' but like you said, its VERY SLOW! Would it be better to do an HLOOKUP and create a master legend for the ranges to go into the array? Is there a better way to do this without the array?

    I really appreciate the help!

    Thank you very much,

    Jim

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

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    Your response #2 you missed my point. Don't tell me HOW you did it, tell me in a short sentence WHAT value you're trying to retrieve back to cell F2. What value retrieve back to G2?

  8. #8
    Registered User
    Join Date
    04-25-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    Sorry, about that!

    Cell G2 needs to get the "2"s from the column labelled Q2_1_1 (in Passport Survey sheet) and divide it by the number of respondents (cell E2). Cell H2 needs to get the "3"s and divide it by the number of respondents. They are not summed figures but rather counted (3+3= 2 respondents with 3 as a response...).

    Thanks!

    Jim

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

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    So you're looking for the percentages of each LongLegendValue? F2 resolves to 5 so the result would be 8.3% of all answers?

    The formula that would go in F2 would be:

    =COUNTIFS(OFFSET(INDEX('Passport Survey - Annual Study'!$1:$1, MATCH($C2, 'Passport Survey - Annual Study'!$1:$1, 0)), 2, , 9998), COLUMN(A1),'Passport Survey - Annual Study'!$E$3:$E$10000, $D2)/$E2

    Format that cell as percentage with a decimal or two, then copy that cell down and across your table. The workbook immediately loses its snailish behavior.

  10. #10
    Registered User
    Join Date
    04-25-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    That did it perfectly!

    Thank you very much. I'm playing around with what you did so that I understand what you did - I need to learn too

    Again, thank you!

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

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    COUNTIFS() is a much simpler formula than my example shows.... learn that first.

    =COUNTIFS(testrange1, criteria1, opttestrange2, optcriteria2, opttestrange3, optcriteria3, etc...)

    My use of the OFFSET() method to find the date in row1, offset down 2 rows, then expand to 9998 rows, that makes it look overly complex.

    Happy deciphering.

  12. #12
    Registered User
    Join Date
    04-25-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    I agree, I need to spend more time with some of the more basic commands. I think I immediately jump the gun and think something is going to be complicated and make it complicated. haha

    I'm just very happy with the way it turned out, thanks to you.

    Jim

  13. #13
    Registered User
    Join Date
    04-25-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Populate columns in one sheet based off of a few lists in a different sheet

    So I have another question based on my first post in this thread.

    In the file that JBeaucaire first posted, he created a formula that would populate two columns for me. I now need to expand that to populate 3 (or more) columns.

    Here is a file that has roughly what I'm trying to accomplish. I thought I had it, but I just can't get column C in "Results" to replicate for each country. I'm sure its something really simple...

    Thank you for any help or advice you may have for me!
    Attached Files Attached Files

+ 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