+ Reply to Thread
Results 1 to 11 of 11

Populating a column based on previous data in 2 other columns

  1. #1
    Registered User
    Join Date
    04-26-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Populating a column based on previous data in 2 other columns

    This is what I've come up with so far;

    =IF(AND(B1=B2,B2=B3),A1&", "&A2&", "&A3, IF(B1=B2,A1&", "&A2, A1))

    It is limited to 3 cells sadly but I need it to work into the thousands.

    What needs to happen is (Please see my data set for you)...

    Please Login or Register  to view this content.
    We'll take the spreadsheet for example, it'll where there's a match in B2 and B3, it'll copy C2 and C3 and put in another cell seperated with ", ".

    Ideally resulting in a format similiar to -

    Please Login or Register  to view this content.
    I would honestly give a kidney for any help on the matter.
    Last edited by JJJJ1; 04-27-2010 at 11:43 AM. Reason: Broke the rules :(

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: VB Script or If possible in a macro?

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

  3. #3
    Registered User
    Join Date
    04-26-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: VB Script or If possible in a macro?

    I hope this is a little more appropriate.
    Last edited by davesexcel; 04-26-2010 at 07:27 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Populating a column based on previous data in 2 other columns

    Much better, thanks.

    Now post a workbook with before and after examples.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    04-26-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Populating a column based on previous data in 2 other columns

    As requested, it's pretty much the same as the text I have posted. I'd appreciate any help on the matter.

    Basically, the idea of this is to build up a list of the serial numbers in third column seperated by ", "
    Attached Files Attached Files

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Populating a column based on previous data in 2 other columns

    Try this:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-26-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Populating a column based on previous data in 2 other columns

    Thank you for the quick response and I appreciate the effort, but It's comming up with an error on the following line

    Please Login or Register  to view this content.
    Saying subscript out of range, now I've tried searching but I'm unsure as to what i'm supposed to set wks to.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Populating a column based on previous data in 2 other columns

    Change the word Before to whatever the worksheet name is.

  9. #9
    Registered User
    Join Date
    04-26-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Populating a column based on previous data in 2 other columns

    Please Login or Register  to view this content.
    I've changed it to this with a workbook called Test. In the workbook I open the macro's panel, create new macro and slam it in like normal.

    It is still returning the same error

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Populating a column based on previous data in 2 other columns

    It's not the WORKBOOK name, it's the SHEET name--what you see on the tab.

  11. #11
    Registered User
    Join Date
    04-26-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Populating a column based on previous data in 2 other columns

    Oh my, thank you and that is working perfectly.

    Something I guess i'll have to check for is where there is a space or double space after something in a column.

    I really appreciate this, thanks again.

+ 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