+ Reply to Thread
Results 1 to 12 of 12

Need VBA to create cross table from rawdata end with sumifs function

  1. #1
    Forum Contributor
    Join Date
    04-30-2013
    Location
    washington
    MS-Off Ver
    Excel 2019
    Posts
    168

    Need VBA to create cross table from rawdata end with sumifs function

    Hi experts

    I have set of data which contains sales data Product ,unit price and week

    i want generate cross wizard table from rawdata
    as column C:C value fill unique value in column A:A Start at A9
    as column E:E value fill unique value in Row(8:8) start B8

    fill formula across =SUMIFS(Data!$D:$D,Data!$C:$C,$A9,Data!$E:$E,B$8)&B9/$B$18 result as 5 (10%)

    find the attachment
    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 insider Version 2507 Win 11
    Posts
    24,929

    Re: Need VBA to create cross table from rawdata end with sumifs function

    Create a Pivot Table as shown in the attached.
    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 Contributor
    Join Date
    04-30-2013
    Location
    washington
    MS-Off Ver
    Excel 2019
    Posts
    168

    Re: Need VBA to create cross table from rawdata end with sumifs function

    hi sir thanks for your time i have huge data process where column week nos extent pivot ask space sum and percentage of sum, if you can help with vba ,more helpful for ever.

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

    Question Re: Need VBA to create cross table from rawdata end with sumifs function


    Hi,

    what could be the objective reason for those useless duplicate columns in your expected result ?‼

  5. #5
    Forum Contributor
    Join Date
    04-30-2013
    Location
    washington
    MS-Off Ver
    Excel 2019
    Posts
    168

    Re: Need VBA to create cross table from rawdata end with sumifs function

    its my explanation but incomplete , please find the attachment its my expectation output if i add more data in raw file column and row variable should expend depend upon unique count.
    Attached Files Attached Files

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

    Arrow Re: Need VBA to create cross table from rawdata end with sumifs function


    As it's obviously better to use codes rather than names in case of any typo or upper-lower cases issue
    but as here the Product Code column was created by Dumb or Dumber
    so the names should be used and in case of any name issue you could amend the VBA procedure yourself
    if the codes column is smarter in your real workbook …

    And using useless merged cells could raises somme issue
    but you could amend the VBA procedure yourself in such case …

  7. #7
    Forum Contributor
    Join Date
    04-30-2013
    Location
    washington
    MS-Off Ver
    Excel 2019
    Posts
    168

    Re: Need VBA to create cross table from rawdata end with sumifs function

    i cleared merged cells and made genuine view please have a look , help me
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Need VBA to create cross table from rawdata end with sumifs function

    Hello.
    I show you the dynamic table proposed by Alan but slightly modified in its order.
    I suggest you do the following test:

    - Add some new data in the 'Data' sheet.
    - Go back to the 'Table' sheet, right click on any cell of the pivot table and select 'Refresh'.

    Isn't that what you're looking for?...
    Attached Files Attached Files
    Last edited by beyond Excel; 11-25-2022 at 09:57 PM.
    You are always very welcome if you add reputation by clicking the * (bottom left) of each message that has helped you.

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

    Re: Need VBA to create cross table from rawdata end with sumifs function


    ( removed )
    Last edited by Marc L; 11-25-2022 at 11:17 PM.

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

    Cool Try this !


    According to the post #7 attachment a VBA demonstration for starters :

    PHP Code: 
    Sub Demo1()
        
    Dim C%, WR&, L&, V(), P&
            
    1
            W 
    Sheet2.[A1].CurrentRegion.Columns("B:D")
        
    With New Collection
            On Error Resume Next
        
    For 2 To UBound(W)
           .
    Add .Count 2W(R1)
        
    Next
            On Error 
    GoTo 0
            L 
    = .Count 2
            ReDim V
    (1 To L1 To C)
            
    V(1C) = "Sale Table"
            
    V(LC) = "Grand Total"
        
    For 2 To R 1
            P 
    = .Item(W(R1))
            If 
    IsEmpty(V(P1)) Then V(P1) = W(R1)
            If 
    W(R3) <> W(13Then C 1ReDim Preserve V(1 To L1 To C): V(1C) = W(R3)
            
    V(LC) = V(LC) + W(R2)
            
    V(PC) = V(PC) + W(R2)
        
    Next
        End With
        
    For 2 To C
        
    For 2 To L 1
            V
    (RC) = V(RC) & Format(V(RC) / V(LC), " (0%)")
        
    Next RC
        With Sheet1
    .[A8].Resize(L1)
            .
    CurrentRegion.Clear
            
    .Borders.Weight 2
            
    .HorizontalAlignment xlCenter
            
    .NumberFormat "  @  "
             
    Union(.Rows(1), .Rows(L)).Interior.ColorIndex 24
            
    .Value V
            
    .Columns.AutoFit
             Application
    .Goto .Parent.[A1], True
        End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Need VBA to create cross table from rawdata end with sumifs function

    johnlara,

    try
    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    04-30-2013
    Location
    washington
    MS-Off Ver
    Excel 2019
    Posts
    168

    Re: Need VBA to create cross table from rawdata end with sumifs function

    Thanks Alot Boss Saved my project greateful to you its solved

    last question where do i make change if i want do average function instead of count in result range fill from B9:D17.

+ 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. Need VBA help to create 3 unique dashboard from rawdata
    By henrybrothers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-25-2022, 08:40 AM
  2. [SOLVED] Cross table to identify cross selling of products
    By kh99523 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-13-2021, 06:13 PM
  3. VBA to create pivottable from rawdata and fill the formula in 2 range
    By johnlara in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-17-2016, 11:49 PM
  4. Trying to use a sumifs function on a pivot table- Thank you for your help
    By JCarollo765 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-15-2016, 12:38 AM
  5. need vba fetch data from pivot table or rawdata depends upon m column value
    By julielara in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2016, 04:35 AM
  6. Need help to create parts cross reference table
    By hp801 in forum Excel General
    Replies: 1
    Last Post: 01-29-2014, 05:55 AM
  7. : help to create critical macro to copy data from rawdata file by 5 condition and pas
    By nirmala_kr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2010, 01:57 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