+ Reply to Thread
Results 1 to 12 of 12

bring the last balance for each customer based on adjacent cell contain date

  1. #1
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    280

    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
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi, try this !


    According to your attachment a VBA demonstration for starters :

    PHP Code: 
    Sub Demo1()
            
    Dim Ra As RangeR&
            [
    F1].CurrentRegion.Clear
            Application
    .ScreenUpdating False
            Columns
    ("A:B").AdvancedFilter 2, , [F1], True
       With Range
    ("F1"Cells(Rows.Count7).End(xlUp)).Rows
           
    .Sort .Cells(1), 1Header:=1
            
    If IsEmpty(.Cells(.Count1)) Then .Item(.Count).Clear
       End With
            
    [D1].Copy [H1]
        For 
    Each Ra In Range("A2"Cells(Rows.Count1).End(xlUp)).SpecialCells(2).Areas
            R 
    Ra.Row
            
    While IsEmpty(Cells(12)) And Not IsEmpty(Cells(14)):  1:  Wend
            Set Ra 
    Cells(Application.Match(RaColumns(6), 0), 8)
            If 
    IsEmpty(RaThen Cells(R4).Copy Ra Else Ra Cells(R4) - Ra
        Next
            Application
    .ScreenUpdating True
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  3. #3
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    280

    Re: bring the last balance for each customer based on adjacent cell contain date

    thank for your code .
    but I don't need REF column .

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: bring the last balance for each customer based on adjacent cell contain date


    No sense to work on names ! As obviously some name can have duplicates for different people versus Ref which is unique …

    Anyway thanks for the rep' !

  5. #5
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    280

    Re: bring the last balance for each customer based on adjacent cell contain date

    what I meant after use ref as unique then no need to show it. the most important is name.
    anyway thank you for your assistance .

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Exclamation Re: bring the last balance for each customer based on adjacent cell contain date


    In case you have duplicates names how can you differ them without their Ref ?

  7. #7
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    280

    Re: bring the last balance for each customer based on adjacent cell contain date

    how can you differ them without their Ref ?
    also there is duplicates ref for the duplicates names
    what if the ref column is not existed?
    so you wanna say it's impossible to achieve that totally?

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    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 …

  9. #9
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    280

    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 !

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: bring the last balance for each customer based on adjacent cell contain date

    Please Login or Register  to view this content.
    Last edited by jindon; 09-25-2023 at 03:34 AM. Reason: sort the names based on letters from small to big (A-Z)

  11. #11
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    280

    Re: bring the last balance for each customer based on adjacent cell contain date

    @ jindon
    great !
    can you sort the names based on letters from small to big (A-Z),please?

  12. #12
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    280

    Re: bring the last balance for each customer based on adjacent cell contain date

    sorry jindon I don't notice your editing for the post !
    thank you so much for the code.

+ 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] Increase Date based on a cell in non adjacent cells
    By Bill_Pearson in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2021, 06:58 AM
  2. Running Balance based on customer code
    By sunboy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-06-2020, 04:46 AM
  3. Enter one value in relevant cell based on the adjacent date
    By SubwAy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-20-2016, 05:06 AM
  4. Array Formula Lookup - Bring back Lowest Date + Bring Back Cell Location
    By Matt1998 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-04-2014, 12:08 PM
  5. Use SumIF based on date in adjacent cell
    By rocketscience in forum Excel General
    Replies: 8
    Last Post: 05-03-2012, 08:56 AM
  6. Locating Max Date based on adjacent cell
    By jensenleesen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-27-2011, 10:58 PM
  7. What is the easiest way to bring up data in adjacent cell after s.
    By Jason in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-10-2005, 06:06 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