+ Reply to Thread
Results 1 to 11 of 11

Macro for extracting data

  1. #1
    Registered User
    Join Date
    02-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Macro for extracting data

    Hi guys,

    I am looking for an excel macro which when I click "Run" will extract the contents of columns C through I from two worksheets "Global 1" and "Global 2" into the respective worksheets AA, FA, KS and TG based on the Marketer values in columns E. Can it also be done such that when an additional Marketer is introduced into column E on any of the Global worksheets, a new worksheet is created with the initials of the newly added marketer?

    Column B in each of the worksheets where the data is extracted to should generate a counter value of 1 when there is data in column D.

    Once the extraction is complete, extracted data in each of the sheets is then sorted by "Ack date with the most recent data on the bottom.

    I am manually creating this currently but I know it will be a pain as the data volume increases. See sample attached.

    Thanks for your help.
    Attached Files Attached Files

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

    Re: Macro for extracting data

    Hey there,
    try this macro-
    Sub extract()
    Please Login or Register  to view this content.
    I have added my name in cell E7 of Global 1 sheet to test that new sheet is added when macro is run.

    Points to be kept in mind while using macro-

    1. In Cell N2 of every "Global" sheet there is the last row number for that sheet. This is a reference cell for the macro. So every time macro is hit the macro runs from the row number after the number mentioned in N2. This row number is automatically updated each time you run the macro. The only thing you need to do is when you add a new global sheet put a 2 in cell N2 of that global sheet, so that macro begins from row 2+1 = 3. In the normal course of operation it is not to be changed manually.

    2. A new sheet named "format" should be placed in your workbook. This sheet acts as a format and layout for the new sheet added by the macro for a new "Marketer" recognized by it. So the "format" sheet is copied and renamed with the initials of the name of the marketer as desired.
    Attached Files Attached Files
    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

  3. #3
    Registered User
    Join Date
    02-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Macro for extracting data

    Hi Sourabh, I really appreciate the good work. This does the job for me and I will keep in mind your points.

    Thanks

  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: Macro for extracting data

    Glad to know that worked!

    If your problem is solved please mark this thread as "Solved" from the "Thread Tools" at the top of the page.

    Also, you can click on "Add Reputation" below my post and leave your feedback there, if that helped

    Have a Great Day!!

    Regards

  5. #5
    Registered User
    Join Date
    02-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Macro for extracting data

    Hi Sourabh,

    I have been playing with the macro and a few items I just noticed and I would love corrections to:

    1. The extracted data is not sorted by date after extraction.
    2. The reference cell N2 counter in each of the Global sheets is not required and confuses the macro when I update any of the cells in the rows that were previously extracted. For example, if after the first extraction, I add or update 'Global 2'!H10:J10, it will not be captured on the next extraction. And if I change the value of 'Global 2'!N2 to 2, the whole data of Global 2 will be recreated. I would prefer N2 to always be 2 and the extraction overwrite the previous contents.

    I am sorry that I might not have explained better previously.

    Regards

  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: Macro for extracting data

    Hi bfadewole,
    So here, to do the overwriting part macro would first delete all the data B3:I102 in all the sheets (excluding global) and then re-extract all the values from "Global" sheet from row 3 always.

    Would that be fine for you?

  7. #7
    Registered User
    Join Date
    02-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Macro for extracting data

    Yes. That works fine.

    Thanks

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

    Re: Macro for extracting data

    Both issues resolved-

    Please Login or Register  to view this content.
    Check attached for reference.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Macro for extracting data

    Works like a charm. ����
    Thanks

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

    Re: Macro for extracting data

    Glad to know that worked!

    If you have no further queries regarding this thread please mark this thread as "Solved" from the "Thread Tools" at the top of the page.

    Also, you can click on "Add Reputation" below my post and leave your feedback there, if that helped.

    Regards

  11. #11
    Registered User
    Join Date
    02-13-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Macro for extracting data

    Hi Sourabh,,

    Thanks once again for helping out on that data extraction macro. I'll like to add a layer of complexity to the process.

    I now have a second workbook with only one sheet with list of Client Name. This list is "not usually" in the same order as the Client Name on the Global sheets of the Fees and Commission workbook and there is only one sheet. This list is only for Clients that Funding Status = Yes. The objective is to have the Yes automatically populate for those Clients.

    Secondly, I'll like to set a commission percentage for each Marketer that is applied into their individual sheets. For example, if the agreed commission for ANDREW AMPARO and KEN SMITH is 50% and 30% respectively, the commission cell for that Client generated by KEN SMITH should = Total Bill*0.3.

    Can you please help once more with this task? let me know if you need more information.

    Thanks
    Attached Files Attached Files
    Last edited by bfadewole; 02-22-2016 at 12:13 PM. Reason: Typo

+ 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. Macro for extracting data to another work sheet
    By canucks in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 12-02-2013, 09:36 AM
  2. Extracting certain data from macro file
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-09-2013, 03:38 AM
  3. [SOLVED] Need help with extracting data with macro
    By excel2891 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-16-2012, 03:21 AM
  4. Need Help with Macro extracting data to Email
    By weesteev in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-08-2012, 06:50 AM
  5. Macro extracting data from various worksheets
    By Laylow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2011, 04:27 AM
  6. MACRO: extracting data from multiple excel files
    By fclt in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2011, 04:55 AM
  7. Macro extracting data from one table to another
    By dandavis1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2008, 04:55 AM
  8. Extracting Data from Combo Boxes with a Macro
    By ddoney in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-08-2005, 12:26 PM

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