+ Reply to Thread
Results 1 to 13 of 13

calculation amounts for BANK & CASH across sheets based on matching partial item

Hybrid View

  1. #1
    Registered User
    Join Date
    06-30-2023
    Location
    Tripoli
    MS-Off Ver
    2013
    Posts
    24

    calculation amounts for BANK & CASH across sheets based on matching partial item

    Hi
    the result should be in G2,G3 for BALANCES sheet.
    in column (RECEIVED/PAID/NOT PAY) as in header for each sheet contains BANK or CASH should merge amounts are existed in last column with exclude AGGREGATE row from calculation across sheets first .
    second should subtract the merged amounts from each other of them (RECEIVED -PAID) for BANK or CASH .
    after that should sum the balance to B2,B3
    example:
    when merge RECEIVED for BANK for three sheets(SL,RS,VC)
    RECEIVED BANK=40400+13400+480+120+200=54600
    when merge PAID for BANK for four sheets(PR,RP,EP,VC)
    PAID BANK=15000+2620+1100+1100+11500+1500+200+200=33200
    after that should be 54600-33200=21380
    final step when show the result in G2 for BANK should add to B2 will be like this=
    21380+200000=221380 as show in G2
    the same thing for CAH whether PAID or RECEIVED.
    also posted in this forum
    https://www.mrexcel.com/board/thread...-item.1257716/
    if it's my way is really comlicated I accept any idea to make easy th solution.
    any solution to do that will be great.
    Attached Files Attached Files
    Last edited by Omran Y; 05-11-2024 at 10:39 AM.

  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
    28,509

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    Your data in the file is inconsistent/wrong :


    when merge RECEIVED for BANK for three sheets(SL,RS,VC)
    RECEIVED BANK=40400+13400+480+120+200=54600
    SL/SR do not have "RECEIVED BANK" only "PAID BANK" whereas VC has "RECEIVED BANK"....

    when merge PAID for BANK for four sheets(SL,RS,EP,VC)
    PAID BANK=15000+2620+1100+1100+11500+1500+200+200=33200
    These figures do not agree with your file .....

    "PAID BANK" in SL are 40,400 and 13,400
    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
    06-30-2023
    Location
    Tripoli
    MS-Off Ver
    2013
    Posts
    24

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    I'm really sorry !
    I edited file with some details .

  4. #4
    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
    28,509

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    I don't see any diffrence in the file if it has been edited.

  5. #5
    Registered User
    Join Date
    06-30-2023
    Location
    Tripoli
    MS-Off Ver
    2013
    Posts
    24

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    I change SL sheet to contain RECEIVED BANK and correct error sheets when I stat where should merge
    see this
    when merge PAID for BANK for four sheets(PR,RP,EP,VC)
    and compare with your ask for that in post 2 an I correct the sheets where should merge

  6. #6
    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
    28,509

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    Sheet "SL" is NOT changed.
    Last edited by JohnTopley; 05-11-2024 at 08:54 AM.

  7. #7
    Registered User
    Join Date
    06-30-2023
    Location
    Tripoli
    MS-Off Ver
    2013
    Posts
    24

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    sorry again !
    dited file

  8. #8
    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
    28,509

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    Option Explicit
    Sub demo()
    Dim WS_Count As Integer, i As Integer, j As Integer, pCol As Integer, tCol As Integer, lr As Long
    Dim ShtArr, PaidArr, x
    Dim pr(1 To 4)  As Double
    Dim ws As Worksheet
    Dim wsn As String
    ShtArr = Array("SL", "RS", "VC", "PR", "RP", "EP")
    PaidArr = Array("RECEIVED BANK", "RECEIVED CASH", "PAID BANK", "PAID CASH")
    
    Application.ScreenUpdating = False
    
    For i = 1 To 6
    
        Set ws = Sheets(ShtArr(i - 1))
        
            With ws
                pCol = Application.Match("*" & "PAY", .Rows("1:1"), 0) ' Find column with "PAY" header
                tCol = Application.Match("TOTAL", .Rows("1:1"), 0)     ' Find "TOTAL" column
                If i <= 3 Then
                    For j = 1 To 2                                        ' Loop through RECEIVED                      x
                         pr(j) = pr(j) + WorksheetFunction.SumIfs(.Columns(tCol), .Columns(pCol), PaidArr(j - 1) & "*")
                    Next j
                End If
                If i >= 3 Then
                    For j = 3 To 4                                        ' Loop through PAID
                         pr(j) = pr(j) + WorksheetFunction.SumIfs(.Columns(tCol), .Columns(pCol), PaidArr(j - 1) & "*")
                    Next j
                End If
                
            End With
        
    Next i
    
    With Sheets("BALANCES")
        .[G2] = .[b2] + (pr(1) - pr(3))   ' BANK
        .[G3] = .[B3] + (pr(2) - pr(4))   ' CASH
        .[G6].Resize(4, 1) = Application.Transpose(pr) '  <<<< for TESTING only
    End With
    
    Application.ScreenUpdating = True
    
    End Sub
    Attached Files Attached Files
    Last edited by JohnTopley; 05-11-2024 at 09:51 AM.

  9. #9
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,458

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    Why do some entries have PAYED and some PAID?

    I'm guessing it is an error and all should be PAID...
    Sub J3v16()
    Dim ShtArr, Bnk As Double, Csh As Double, Col1 As Long, Col2 As Long, i As Long
    ShtArr = [{"SL","PR","RS","RP","EP","VC"}]
    For i = 1 To UBound(ShtArr)
        Col1 = IIf(i = 6, 5, 8): Col2 = IIf(i = 6, 4, 5)
        With Sheets(ShtArr(i))
            Bnk = Bnk + WorksheetFunction.SumIfs(.Columns(Col1), .Columns(Col2), "RECEIVED BANK*")
            Bnk = Bnk - WorksheetFunction.SumIfs(.Columns(Col1), .Columns(Col2), "PAID BANK*")
            Csh = Csh + WorksheetFunction.SumIfs(.Columns(Col1), .Columns(Col2), "RECEIVED CASH*")
            Csh = Csh - WorksheetFunction.SumIfs(.Columns(Col1), .Columns(Col2), "PAID CASH*")
        End With
    Next i
    Range("G2") = Range("B2") + Bnk
    Range("G3") = Range("B3") + Csh
    End Sub
    Last edited by Sintek; 05-11-2024 at 10:24 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  10. #10
    Registered User
    Join Date
    06-30-2023
    Location
    Tripoli
    MS-Off Ver
    2013
    Posts
    24

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    I'm guessing it is an error and all should be PAID...
    yes, sorry guys for this chaos!
    I will check your solution and come back .

  11. #11
    Registered User
    Join Date
    06-30-2023
    Location
    Tripoli
    MS-Off Ver
    2013
    Posts
    24

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    Thank you so much ,Guys!

  12. #12
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,458

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    Glad to have contributed...Tx for rep +

  13. #13
    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
    28,509

    Re: calculation amounts for BANK & CASH across sheets based on matching partial item

    Thanks fo the rep

+ 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] merge amounts for adjacent cells under header based on matching part of item
    By Ali-M in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-13-2024, 05:03 AM
  2. [SOLVED] Populate amounts for separated range based on matching headers across sheets for partial
    By abdo M in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-02-2023, 01:20 PM
  3. calculation at the same column based on matching two sheets to show balance
    By tubrak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2022, 10:46 PM
  4. [SOLVED] Help on sort filter formula based on cash or bank
    By sunboy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2021, 04:59 PM
  5. [SOLVED] Post bank transactions to bank Recon as individual amounts instead of sums
    By SjMaxwell in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-16-2018, 03:15 AM
  6. Bank reconciliation - Many to one matching and partial cell matching
    By maartendelaet in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-25-2010, 08:21 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