bring the last balance for each customer based on adjacent cell contain date
Hi
I want brings the last balance in last cell for each name in column B , if there are duplicates names then should subtract the last balance for each other of the same name as in ALLAA,AMRR .
when brings the last balance should be based on adjacent last cell contains date in column C for each name .
the result should be in columns F:G and will add new data could be 3000 rows in A:D so should change in F:G every time run the macro .
thanks in advanced
According to your attachment a VBA demonstration for starters :
PHP Code:
Sub Demo1() Dim Ra As Range, R& [F1].CurrentRegion.Clear Application.ScreenUpdating = False Columns("A:B").AdvancedFilter 2, , [F1], True With Range("F1", Cells(Rows.Count, 7).End(xlUp)).Rows .Sort .Cells(1), 1, Header:=1 If IsEmpty(.Cells(.Count, 1)) Then .Item(.Count).Clear End With [D1].Copy [H1] For Each Ra In Range("A2", Cells(Rows.Count, 1).End(xlUp)).SpecialCells(2).Areas R = Ra.Row While IsEmpty(Cells(R + 1, 2)) And Not IsEmpty(Cells(R + 1, 4)): R = R + 1: Wend Set Ra = Cells(Application.Match(Ra, Columns(6), 0), 8) If IsEmpty(Ra) Then Cells(R, 4).Copy Ra Else Ra = Cells(R, 4) - Ra Next Application.ScreenUpdating = True End Sub
► Do you like it ? ► ► So thanks to click on bottom left star icon « ★ Add Reputation » ! ◄ ◄
Re: bring the last balance for each customer based on adjacent cell contain date
So you misread & misunderstood : two clients with the same name so two different Refs
not really understand it !
when repeat the client will repeat the ref for the same repeated client . so I don't see difference between column A,B about duplicates !
Bookmarks