Max date from loop

Forestq

Active Member
Joined
May 9, 2010
Messages
482
Hi,

In column A I have "reported period" and in column C I have "account name". Each month I have new series data contains reported period and account name, and now I want to select MAX date for looking account.

Example:
Reported Period (column A)Account Name (column C)
12/09/2014Audi
12/09/2014BMW
12/09/2014VW
09/10/2014Audi
09/10/2014BMW
09/10/2014FORD

<tbody>
</tbody>

Max date for Audi, BWM is 09/10/2014, but for VW is 12/09/2014.

Code:
RP_SET = "01/01/2010"

 For g = 2 To rowdata_lr
        If wsRD_M.Range("C" & g).Value = looking_cust Then
                
                RP = wsRD_M.Range("A" & g).Value
                                
                     If RP_SET < RP Then
                        
                        NEW_RP = RP
        
                    End If
        
        End If
    Next g

but something is wrong....
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hello,

could you provide all of the VB code.

Isn't the Max date for Audi & BMW 12/09/2014?
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,938
Members
449,197
Latest member
k_bs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top