+ Reply to Thread
Results 1 to 12 of 12

Organize data Idea

Hybrid View

  1. #1
    Registered User
    Join Date
    11-07-2023
    Location
    Florida, USA
    MS-Off Ver
    Microsoft 365 and Office
    Posts
    70

    Organize data Idea

    Hello,



    Thank you.
    Last edited by Ladyj07; 02-14-2025 at 12:37 PM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,174

    Re: Organize data Idea

    I would use VBA but as you have 365, then perhaps one of the 365-formula wizards can provide a formula-based solution.

    See attached

    Option Explicit
    
    Sub demo()
    Dim a, b, col
    Dim i As Long, j As Long, n As Long, lr As Long
    Dim EmpName As String, EmpId As String, accrual As String
    col = Array(1, 3, 4, 5, 6, 7)
    
    With Sheets("Sheet1")
    
        lr = .Cells(Rows.Count, "C").End(xlUp).Row
        a = .Range("A1:G" & lr)
        ReDim b(1 To UBound(a, 1), 1 To 10)
        
        For i = 1 To UBound(a, 1)
            EmpName = Trim(Split(a(i, 1), ":")(1))
            EmpName = Trim(Replace(EmpName, "Number", ""))
            EmpId = Trim(Split(a(i, 1), ":")(2))
            i = i + 1
            accrual = Trim(Split(a(i, 1), ":")(1))
            i = i + 1
            Do
              If IsDate(a(i, 1)) Then
                n = n + 1
                b(n, 1) = EmpName: b(n, 2) = EmpId: b(n, 3) = accrual
                For j = 0 To 5
                  b(n, j + 4) = a(i, col(j))
                  If b(n, j + 4) = "----" Then b(n, j + 4) = 0
                  If b(n, j + 4) = "" Then b(n, j + 4) = 0
                Next j           
              End If
              i = i + 1
            Loop Until a(i, 1) = "Total for Accrual:"
              b(n, 10) = a(i, 7)
              n = n + 1
              If i >= UBound(a, 1) Then Exit For
        Next i
    End With
    
    With Sheets("Sheet2")
         n = n - 1
        .[A2].Resize(10000, 19).Clear
        .[A2].Resize(n, 10) = b
        .Columns(5).Resize(, 6).NumberFormat = "#0.00"
        .Columns(1).Resize(, 9).AutoFit
        
    End With
    End Sub

    See Sheet2 (RUN button)

    UPDATE: I see you have formula from Windknife in next post!
    Attached Files Attached Files
    Last edited by JohnTopley; 02-07-2025 at 12:45 PM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Registered User
    Join Date
    11-07-2023
    Location
    Florida, USA
    MS-Off Ver
    Microsoft 365 and Office
    Posts
    70

    Re: Organize data Idea

    @JohnTopley Ohh it didn't cross my mind that this could be done via macros. I will run it against my original file and let you know.
    Last edited by Ladyj07; 02-10-2025 at 11:19 AM.

  4. #4
    Registered User
    Join Date
    11-07-2023
    Location
    Florida, USA
    MS-Off Ver
    Microsoft 365 and Office
    Posts
    70

    Re: Organize data Idea

    John, In my original file I have :



    Is there a way the code be modify so It will look for anything that start with "Totals for Bank " as after this depending on the row it could change to "ops" or Corp"

    Right now this line is: "Totals " and I understand you put it like that because when I upload the test file I changed it manually to said that but the original titles are as shown above.


    Thank you
    Last edited by Ladyj07; 02-12-2025 at 04:13 PM.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,174

    Re: Organize data Idea

    See attached
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-07-2023
    Location
    Florida, USA
    MS-Off Ver
    Microsoft 365 and Office
    Posts
    70

    Re: Organize data Idea

    THANK YOU!! You are a live saver. Everything works perfectly and now I can audit this so easily. Thanks!!

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,174

    Re: Organize data Idea

    Glad to have helped and many thanks for the rep

  8. #8
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,976

    Re: Organize data Idea

    One way,
    T1
    =LET(
      a,A1:G1000,
      b,VSTACK(TOCOL(IF(LEFT(INDEX(a,,1),8)="Employee",ROW(a),1/0),3),1000),
      IFERROR(DROP(REDUCE("",SEQUENCE(ROWS(b)-1),LAMBDA(m,n,VSTACK(m,LET(c,FILTER(a,(SEQUENCE(ROWS(a))>=INDEX(b,n,1))*(SEQUENCE(ROWS(a))<INDEX(b,n+1,1)),""),d,TRIM(TEXTBEFORE(TEXTAFTER(INDEX(c,1,1),"Employee:"),"Number:")),e,TEXTAFTER(INDEX(c,1,1),"Number:"),f,TEXTAFTER(INDEX(c,2,1),"Accrual : "),VSTACK(REDUCE(HSTACK("employee name","employee id","accrual bank","date posted","Accrued","Expired","Taken","Adjustments","Period Net","Balance"),SEQUENCE(ROWS(c)-4,,5),LAMBDA(x,y,IF(INDEX(c,y,1)="",x,IF(INDEX(c,y,1)="Total for Accrual:",VSTACK(x,HSTACK(d,e,f,"-","-","-","-","-","-",INDEX(c,y,7))),VSTACK(x,HSTACK(d,e,f,INDEX(c,y,1),TAKE(INDEX(c,y,),,-5),"-")))))),"",""))))),1),"")
    )
    Attached Files Attached Files

+ 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. Any idea for data arrangement?
    By okeyla in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-11-2023, 05:31 AM
  2. Get data from PDF idea
    By lastnn30 in forum Excel General
    Replies: 1
    Last Post: 06-27-2022, 07:58 PM
  3. Idea for Data Analysis
    By maddyrafi1987 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-09-2018, 03:21 AM
  4. Replies: 14
    Last Post: 03-21-2018, 07:05 PM
  5. Design Idea's for my data
    By dougers1 in forum Excel General
    Replies: 2
    Last Post: 04-30-2016, 04:43 PM
  6. [SOLVED] What is best idea to keep all my data in the macro module ?
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-11-2013, 10:34 AM
  7. data...idea/thoughts
    By jw01 in forum Excel General
    Replies: 9
    Last Post: 02-24-2012, 05:14 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