View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] rachitm@gmail.com is offline
external usenet poster
 
Posts: 23
Default Find Last duplicate value in Column A

Hi Tom,

What if I wanted to find the last duplicate value the following way:

IF this is the data,

A B

1: day1 Jan
2: day1 Feb
3: day1 Mar
4: day2 Apr
5: day2 May
6: day3 June
7: day3 July
8: day5 Aug
9: day5 Sep

How could I display the last value of each type and the respective
column B data (in a textbox):

day1 Mar
day2 May
day3 July
day5 Sep

Thanks!

On Feb 7, 11:53 am, wrote:
This works perfect! Thank you for your help!

On Feb 7, 11:37 am, Tom Ogilvy
wrote:



Sub FindLastDuplicate()
dim lastrow = cells(rows.count,1).End(xlup).row
for i = lastrow to 2 step -1
if application.countif(Range("A:A"),cells(i,1)) 1 Then
Range("B1").Value = cells(i,1)
exit sub
end if
Next
End Sub


Would be a code approach. Are you looking for a formula instead?


--
Regards,
Tom Ogilvy


" wrote:
How do I find last duplicate value in Column A and put it in a cell
B1?


Appreciate all help- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -