+ Reply to Thread
Results 1 to 10 of 10

Should I use a formula or Macro to pull specific data from one tab to another

  1. #1
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Should I use a formula or Macro to pull specific data from one tab to another

    Hello all,
    I have a Raw Dump worksheet that all of my collected data goes into. I would like to have different worksheets within the same workbook that pulls specific rows from the Raw Dump based on the "CName" column. Would a formula work for this or would a Macro be best? I've attached a test sheet with a basic layout of what I am trying to do as well.

    test.png
    Attached Files Attached Files
    Last edited by devildogdad76; 07-23-2019 at 12:09 AM. Reason: admin request change to adhere by Forum posting rules

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Formula or Macro

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Formula or Macro

    Sorry about that. Title is updated now.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Should I use a formula or Macro to pull specific data from one tab to another

    No problem, thanks for the change.

    A
    B
    C
    D
    1
    A
    Person
    Date
    ID
    2
    A Anthony
    43635
    1111
    3
    A Pete
    43635
    1122
    4
    A Chris
    43635
    5763
    5
    6
    7


    What I did here was use your headings from Dump, but changed the 1st heading to show which letter you want (A1)
    I then used this ARRAY formula...
    A2=IFERROR(INDEX('Raw Dump'!A:A,SMALL(IF('Raw Dump'!$A$2:$A$9=$A$1,ROW('Raw Dump'!$A$2:$A$9)),ROWS($A$1:A1))),"")
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    Copy this down as needed, then copy all of "A" across to the other columns.
    You can then copy that whole range to the other sheets.

    Note however, if you have a LOT of data (10 000's or rows), this may show your file down and VBA might be better.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Should I use a formula or Macro to pull specific data from one tab to another

    Hi,

    I'd do this problem using Advanced Filters. See the attached where I've done your problem using them. You will need to create a criteria range on each sheet and I've created a Dynamic Named Range for your raw data. See the attached. It should be much faster than the CSE suggestion above or even VBA since it is native Excel.

    Advanced Filter for Each Sheet.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  6. #6
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Should I use a formula or Macro to pull specific data from one tab to another

    Thank you both. I wasn't able to get the CSE suggestion working unfortunately. On the AF suggestion, I think I am doing something wrong. When I apply the AF on a single sheet it blanks out row 2, but never shows any data. I have only tried this on Sheet A. I've attached an updated copy of my workbook.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Should I use a formula or Macro to pull specific data from one tab to another

    I got the advanced filtering figured out. Is there any way that this could be automated or do I need to run a new AF after each time new data is entered?

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Should I use a formula or Macro to pull specific data from one tab to another

    Hi,

    See if this helps:

    Advanced Filters For Sheets 2.xlsx

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Should I use a formula or Macro to pull specific data from one tab to another

    Quote Originally Posted by devildogdad76 View Post
    Thank you both. I wasn't able to get the CSE suggestion working unfortunately...
    Did you replace CNAME on each sheet, with that sheet's name?
    Did you use CTRL SHFT ENTER to enter the formula?

  10. #10
    Registered User
    Join Date
    07-08-2019
    Location
    Shawnee, Oklahoma
    MS-Off Ver
    Office 365 ProPlus
    Posts
    51

    Re: Should I use a formula or Macro to pull specific data from one tab to another

    I got this method to work and it is doing exactly what I am needing without need for further automation. I looked back on it today with a pair of fresh eyes and realized that I had copied over the A2 in front of the formula which of course didn't work. Thank you both very much. I've never used advanced filtering before, so that was interesting to learn about and will be looking for something to use that on in the future.
    Last edited by AliGW; 07-24-2019 at 04:36 AM. Reason: Please don't quote unnecessarily!

+ 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 to paste formula in colK after a macro executed
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-20-2017, 08:39 PM
  2. Macro to paste formula to selection that replaces a formula with a named range.
    By Evan69 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-26-2017, 05:46 AM
  3. Problem with recording a macro with long formula - works in Excel but not in macro
    By tonybeo2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-28-2015, 11:25 AM
  4. VBA Macro: Plugging an Array-Formula into a Cell and Dragging Formula Down Columns
    By Brianandstewie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-20-2013, 02:57 PM
  5. Macro: Applying formula to multiple cells in excel (formula editing)
    By city in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-27-2012, 06:41 AM
  6. Replies: 1
    Last Post: 07-20-2006, 03:05 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