+ Reply to Thread
Results 1 to 6 of 6

Convert table

  1. #1
    Registered User
    Join Date
    05-09-2023
    Location
    iran
    MS-Off Ver
    excel 2021
    Posts
    35

    Convert table

    I have attached an excel file that I downloaded from the sales branch website and its information is in sheet one, I want the clean information to be converted like sheet two. For each product and its branch code, the amount of sales and inventory should be entered in front of it so that I know which branch has the sales amount and the amount of inventory for the product and product code. Please provide solution and guide me.
    Please guide step by step so that I can do. Thanks

    data.xlsx
    Last edited by AliGW; 10-16-2023 at 02:45 AM. Reason: Redacted for legibility.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,661

    Re: Convert table

    With sheet1 is raw data, sheet2 is output
    Because of there are arabic language (I am not sure what it is) those can not input within code edit window, I use cell AL1 to store it ("cod" in arabic in cell AM45? I am not sure, but try)
    Just give it a shot.
    Hit the "RUN" button to activate code.

    PHP Code: 
    Option Explicit
    Sub test
    ()
    Dim lr&, i&, j&, k&, tu&, t&, m&, rng
    Dim arr
    (1 To 100001 To 3), res(1 To 100001 To 5), ary
    ary 
    = Array(33252013)
    With Sheets("sheet1")
        
    lr = .Cells(Rows.Count"AH").End(xlUp).Row
        rng 
    = .Range("B14:AM" lr).Value
    End With
    For 1 To UBound(rng)
        If 
    rng(i38) = "cod" Or rng(i38) = Range("AL1").Value Then
            k 
    1arr(k1) = 1arr(k2) = rng(i34): arr(k3) = rng(134)
        
    End If
    Next
    For 1 To k
        
    If k Then tu arr(11) - Else tu UBound(rng)
        For 
    0 To UBound(ary)
            For 
    arr(i1To tu
                
    If rng(tary(j)) <> "" Then
                    m 
    1res(m1) = arr(i2): res(m2) = arr(i3)
                    
    res(m3) = rng(tary(j)): res(m4) = rng(tary(j) - 1): res(m5) = rng(tary(j) - 2)
                
    End If
            
    Next
        Next
    Next
    Sheets
    ("Sheet2").Activate
    Range
    ("A2:E10000").ClearContents
    Range
    ("A2").Resize(m5).Value res
    End Sub 
    Attached Files Attached Files
    Quang PT

  3. #3
    Registered User
    Join Date
    05-09-2023
    Location
    iran
    MS-Off Ver
    excel 2021
    Posts
    35

    Re: Convert table

    bebo021999 Thanks for the reply
    Is there a simpler solution?
    Because there is a lot of information in sheet one and I have sent that file for example.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,661

    Re: Convert table

    So does the code work for your actual file?

  5. #5
    Registered User
    Join Date
    05-09-2023
    Location
    iran
    MS-Off Ver
    excel 2021
    Posts
    35

    Re: Convert table

    Yes - but when you upload the original file in your file, the place osaleDocument_sply_prd_CostCenter_WithPrize (2).xlsxf sale and inventory will be changed, and the sales numbers of each region will be inserted instead of the inventory.
    Last edited by ALI870; 10-17-2023 at 01:01 AM.

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,661

    Re: Convert table

    Try to attach your actual file.

+ 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] How do I convert a table with individual dates to a table with date ranges?
    By frankt68 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-29-2021, 08:58 AM
  2. [SOLVED] Convert table to data structure for pivot table
    By wviveen in forum Excel General
    Replies: 2
    Last Post: 11-09-2020, 11:33 AM
  3. [SOLVED] Password Table - Automatically Convert Text using a Table?
    By iaminneedofhelp101 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-31-2016, 09:27 AM
  4. Replies: 4
    Last Post: 11-29-2015, 07:20 AM
  5. Convert a mutli colum Multi roy table to a 3 column table
    By stratis63 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2015, 11:30 AM
  6. [SOLVED] Convert table with multiple header columns into a pivotable table
    By jasonleewkd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2013, 03:20 AM
  7. [SOLVED] Convert Pivot Table to Normal Data table
    By ashish128 in forum Excel General
    Replies: 2
    Last Post: 05-02-2006, 04:40 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