+ Reply to Thread
Results 1 to 5 of 5

Transpose bank statement from vertical to horizontal and fill missing gaps

Hybrid View

  1. #1
    Registered User
    Join Date
    11-16-2020
    Location
    Aberdeen
    MS-Off Ver
    Excel 2016
    Posts
    5

    Transpose bank statement from vertical to horizontal and fill missing gaps

    So here is a function I have not worked with before, but I believe I want to use a transpose function

    So I have a set of transactions, listed vertically, in a date then value format, with some dates missed out, some dates multiple values
    - to match an old format, I want to list transactions for each day horizontally, and show blank days as well

    I am able to do this one 'batch' at a time manually with transpose command, selecting all the lines for a single date, and pasting special to another cell - that's easy peasy

    But how do I make it work on a big batch of numbers, and is transpose the best command to use?

    I have set up an example, showing two sheets, one as the 'input' and a second sheet as the 'output format'

    I can run this on a single sheet if you want, not bothered if we mess up the data or overwrite it - its getting pasted into a blank sheet then copied out anyways
    In the output, i would like to include all dates, including gaps with no transactions

    total rows so far is around 1000

    Any help appreciated

    Gareth
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,401

    Re: Transpose bank statement from vertical to horizontal and fill missing gaps

    How about

    Sub jec()
     Dim jv, ar, a As Variant, i As Long, j As Long
     jv = Sheets("Input Format").Cells(1, 1).CurrentRegion.Value2
     ReDim ar(1000)
       
     With CreateObject("scripting.dictionary")
         For i = jv(1, 1) To jv(UBound(jv), 1)
            For j = 1 To UBound(jv)
               a = .Item(i)
               If IsEmpty(a) Then a = ar
               If i = jv(j, 1) Then
                  a(0) = i
                  a(1000) = a(1000) + 1
                  a(a(1000)) = jv(j, 2)
               End If
              .Item(i) = a
           Next
            If IsEmpty(.Item(i)(0)) Then a = ar: a(0) = i: .Item(i) = a
        Next
        Sheets("Output Format").Cells(8, 1).Resize(.Count, UBound(a)) = Application.Index(.items, 0, 0)
     End With
    End Sub

  3. #3
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,401

    Re: Transpose bank statement from vertical to horizontal and fill missing gaps

    Another variant

    Sub jec()
     Dim jv, dest As Variant, i As Long, j As Long
     Application.ScreenUpdating = False
     Application.DisplayAlerts = False
     
     jv = Sheets("Input Format").Cells(1, 1).CurrentRegion.Value2
     Set dest = Sheets("Output Format").Cells(8, 1)
     
     With CreateObject("scripting.dictionary")
        For i = jv(1, 1) To jv(UBound(jv), 1)
            For j = 1 To UBound(jv)
               If i = jv(j, 1) Then .Item(i) = .Item(i) & jv(j, 2) & "|"
            Next
           If IsEmpty(.Item(i)) Then .Item(i) = .Item(i)
        Next
        dest.Resize(.Count, 2) = Application.Transpose(Array(.keys, .items))
        dest.CurrentRegion.Columns(2).TextToColumns Sheets("Output Format").Range("B8"), 1, , , , , , , 1, "|"
     End With
    
     Application.DisplayAlerts = True
    End Sub

  4. #4
    Registered User
    Join Date
    11-16-2020
    Location
    Aberdeen
    MS-Off Ver
    Excel 2016
    Posts
    5

    Re: Transpose bank statement from vertical to horizontal and fill missing gaps

    That is Working for me thank you

    Now i just have to go break it down and learn it

    Bedankt en goede nacht!

    Gareth

  5. #5
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,401

    Re: Transpose bank statement from vertical to horizontal and fill missing gaps

    Graag gedaan, van hetzelfde

+ 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] Transpose horizontal to vertical
    By akalien in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-12-2021, 12:09 PM
  2. [SOLVED] transpose last row from horizontal to vertical
    By JACK JOUSH in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-10-2021, 09:04 AM
  3. [SOLVED] Transpose Horizontal to Vertical - one condition
    By ionelz in forum Excel General
    Replies: 4
    Last Post: 10-11-2020, 04:21 PM
  4. Transpose vertical data to horizontal
    By PeterKeown in forum Excel General
    Replies: 6
    Last Post: 08-03-2018, 05:51 AM
  5. Replies: 4
    Last Post: 09-04-2013, 12:42 PM
  6. Transpose Vertical Data to Horizontal
    By Randu555 in forum Excel General
    Replies: 5
    Last Post: 04-18-2013, 05:05 PM
  7. [SOLVED] Transpose Horizontal to Vertical with ID Column
    By galaxycoff in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-04-2012, 10:16 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