+ Reply to Thread
Results 1 to 10 of 10

Copy Exported Data by Category

  1. #1
    Registered User
    Join Date
    10-05-2017
    Location
    Milwaukee
    MS-Off Ver
    2016
    Posts
    15

    Copy Exported Data by Category

    On Sheet1 is exported data and this data continues on for ~2,000 rows (dates in "Column A" and data in "Column E" under category D). Goal is to copy the dates in "Column A" along with the data in "Column E" category D only and paste it in "Sheet2" as shown in the attached workbook.
    test.jpg
    test1.jpg
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: Copy Exported Data by Category

    A power query solution

    Please Login or Register  to view this content.
    Excel 2016 (Windows) 64 bit
    A
    B
    C
    D
    13
    5/23/2023
    6/2/2023
    7/10/2023
    8/10/2023
    14
    1
    1
    1
    1
    15
    2
    2
    2
    2
    16
    3
    3
    3
    3
    17
    4
    4
    4
    18
    5
    5
    19
    6
    6
    20
    7
    7
    21
    8
    22
    9
    23
    10
    Sheet: Sheet2

    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Or try this ...


    According to the attachment a beginner level VBA demonstration for starters :

    PHP Code: 
    Sub Demo1()
             
    Dim Rc As RangeC%
        
    With Sheet1
            
    .UsedRange.Clear
        
    For Each Rc In Sheet2.UsedRange.Columns(1).SpecialCells(2)
            
    1
            Rc
    .Copy .Cells(C)
            
    Range(Rc(35), Rc(25).End(xlDown)).Copy .Cells(2C)
        
    Next
            
    .UsedRange.Columns.AutoFit
        End With
            Set Rc 
    Nothing
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 05-24-2023 at 10:41 AM.

  4. #4
    Registered User
    Join Date
    10-05-2017
    Location
    Milwaukee
    MS-Off Ver
    2016
    Posts
    15

    Re: Copy Exported Data by Category

    Thanks for the feedback guys. These solutions will work. Appreciate the help.

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Copy Exported Data by Category


    Post #3 updated for an optimization …

    Thanks for the rep' !

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: Copy Exported Data by Category

    Thanks for the rep. If you are interested in advancing your skills with PQ, then pick up the book on Amazon by Ken Puls and Miguel Escobar.

  7. #7
    Registered User
    Join Date
    10-05-2017
    Location
    Milwaukee
    MS-Off Ver
    2016
    Posts
    15

    Re: Copy Exported Data by Category

    @ Marc L the code you provided worked however the original cells it is copying from have formulas in them. How can I copy the values instead of the formulas to Sheet2?
    Is it a .PasteSpecial xlPasteValues?

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb Try this ...


    Could be or this :

    PHP Code: 
    Sub Demo2()
             
    Dim Rc As RangeC%, V
        With Sheet1
            
    .UsedRange.Clear
        
    For Each Rc In Sheet2.UsedRange.Columns(1).SpecialCells(2)
            
    1
            V 
    Range(Rc(25), Rc(25).End(xlDown))
            
    V(11) = Rc
            
    .Cells(C).Resize(UBound(V)) = V
        Next
            
    .UsedRange.Columns.AutoFit
        End With
            Set Rc 
    Nothing
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 05-25-2023 at 01:04 PM.

  9. #9
    Registered User
    Join Date
    10-05-2017
    Location
    Milwaukee
    MS-Off Ver
    2016
    Posts
    15

    Re: Copy Exported Data by Category

    Yes, this latest Demo2 code works good. I did remove the .Offset(1) because it wasn't grabbing the first date 5/23/2023 column. But it is copying the values instead of the formulas so mission accomplished. Thanks for the help!

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Copy Exported Data by Category


    I added Offset 'cause my bad I worked from post #2 attachment instead of your original post …
    Last edited by Marc L; 05-25-2023 at 01:14 PM.

+ 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] Macro to filter data by category and delete rows where category sums up to zero
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-02-2021, 12:57 PM
  2. Read, copy and paste from a exported pdf to excel
    By fabian_76 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-14-2017, 06:19 PM
  3. Copy data in categorized order even when a category is missing
    By HenChr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2014, 03:16 AM
  4. Copy Data Exported from Sharepoint to another Workbook
    By karma2400 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2013, 11:19 AM
  5. copy data to another sheet based on category selected
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2013, 03:47 PM
  6. [SOLVED] Copy row data from one sheet to another depending on a category
    By Burli in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-24-2013, 10:13 AM
  7. Copy column data by group/category, where the number of rows change
    By davidmurphy25 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-16-2012, 10:25 PM

Tags for this Thread

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