+ Reply to Thread
Results 1 to 7 of 7

Copy data from one sheet to another depending on condition

  1. #1
    Forum Contributor
    Join Date
    02-23-2007
    Location
    England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2208 Build 16.0.15601.20072) 64-bit
    Posts
    102

    Copy data from one sheet to another depending on condition

    Hello All

    Trust all is well.

    I need one MOTHER of a miracle here guys before I jump off a cliff.

    I have attached a workbook containing two worksheets and what I have been trying to achieve for nearly two weeks now, is to populate one sheet in particular cells with data from the other sheet, depending on certain criteria. I apologise if this doesn't make sense as I am halfway driven mad already by this thing! So rather than waffle a load of confusion, here are my criteria for what I am trying to do:

    What are the worksheets?
    Sheet 1 is a timeline that just shows dates when certain actions are due by (fully automated)
    Sheet 2 is where the detail of what actions are to be taken is manually entered

    What columns from each sheet do I need to use?
    On sheet 1 I will be using Column B (store name), Column C (Product) and Row 5 (which displays the date)
    On sheet 2 I need to use the worksheet name (ASDA in this example), Column C (Date), Column E (action) and Column I (product)

    Ok so what is it I want to achieve?
    From Sheet 1, loop through each cell within column B (from B6 downwards)
    If cell value = a worksheet name, then select cell C6 and go to the worksheet (ASDA in this example)
    From sheet 2 (ASDA) look through column I (from I16 downwards) and for every cell value that matches C6 from sheet 1, do the following:
    Offset to the corresponding value in column A and select that date
    Go back to Sheet 1 (Time line) and from that original cell (C6), scroll across to the right until the date in row 5 matches the date selected from column A in sheet 2
    In that target cell, I want the value of that cell to match the value held in column E on sheet 2

    Ok, using the above example, from the attached workbook the sheet 1 value in cell C6 is showing as ASDA and the product is Chicken Skewers. Using sheet 2 as the reference page (ASDA), the cell E6 on sheet 1 should have the value 'phone call completed'. Then if I scroll to the right of sheet 1 along that same row (6) I should see the value 'store visit rescheduled'. This is because the dates on both sheets match for the cell values.

    Does that make sense? If not then that would explain why I am going mad with this.

    I really hope someone can shed some light on this for me as I am in a very dark place!!!

    Many thanks in Advance
    G1
    Attached Files Attached Files
    Last edited by ghostly1; 04-07-2016 at 04:38 AM.

  2. #2
    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: A MIRACLE is needed for this one!!

    The first miracle we need is a review of the forum rules, and then an amended thread title.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    02-23-2007
    Location
    England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2208 Build 16.0.15601.20072) 64-bit
    Posts
    102

    Re: A MIRACLE is needed for this one!!

    Apologies shg

    Title now amended

    Thanks
    G1

  4. #4
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Copy data from one sheet to another depending on condition

    No need to jump off the cliff.
    Try this macro-
    Please Login or Register  to view this content.
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  5. #5
    Forum Contributor
    Join Date
    02-23-2007
    Location
    England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2208 Build 16.0.15601.20072) 64-bit
    Posts
    102

    Re: Copy data from one sheet to another depending on condition

    Sourabhg98,

    what can I say except one massive THANK YOU! This is EXACTLY what I was after. I can't believe it took you just a short time what I have been trying to achieve in over a coupe of weeks!!! I just do not have the knowledge to use TRIM and the variable like you have, Goes to show I have such a long way to go and know actually very little.

    You have helped my spreadsheet come on in leaps and bounds.
    Thanks again, you are a legend.
    G1

  6. #6
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Copy data from one sheet to another depending on condition

    Glad to know that helped

    The trim just removes extra spaces at the beginning, end or between the words. I used that because I noticed you had some spaces preceding some of the values which created problems while matching.

    And learning is a ever-going process, it would never end. I still have a lot to learn about excel.

  7. #7
    Forum Contributor
    Join Date
    02-23-2007
    Location
    England
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2208 Build 16.0.15601.20072) 64-bit
    Posts
    102

    Re: Copy data from one sheet to another depending on condition

    Well you appear to be a pretty good expert in my eyes anyway. I will keep learning.

    Cheers again and take it easy

    G1

+ 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] a function to copy the things needed from one sheet to another. only the ones needed
    By karim.zheng in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-31-2015, 09:49 AM
  2. Help needed: Do While Loop needed
    By xlislovexlislife in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2015, 11:00 AM
  3. Complex Filter/Sorting Help Needed (VBA knowledge needed)
    By dfxryanjr in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-03-2013, 01:39 PM
  4. [SOLVED] help needed please
    By laduk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2013, 03:00 PM
  5. Conditional formatting needed for shape colour - is programming needed?
    By Farmboyuk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2012, 07:27 AM
  6. Need one miracle
    By John21 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2006, 11:20 PM
  7. More help needed :-(
    By ChrisMattock in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-28-2006, 08:03 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