ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   last duplicate value (https://www.excelbanter.com/excel-programming/382863-last-duplicate-value.html)

[email protected]

last duplicate value
 
Hi...

How could I 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):

A B

day1 Mar
day2 May
day3 July
day5 Sep


Thanks!


Jim Jackson

last duplicate value
 
Sub Find Dupes

Range("A1").Activate
Do
If Activecell = Activecell.Offset(1,0) Then
Activecell.Offset(1,0).Activate
Else
MsgBox("The Last duplicate is " & Activecell.Offset(0,1))
End If
ActiveCell.Offset(1,0).Activate
Loop until Activecell = ""
End Sub
--
Best wishes,

Jim


" wrote:

Hi...

How could I 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):

A B

day1 Mar
day2 May
day3 July
day5 Sep


Thanks!



Bob Phillips

last duplicate value
 
=INDEX($B$1:$B$20,MAX(IF($A$1:$A$20="day1",ROW($A$ 1:$A$20))))

this is an array formula, so commit with Ctrl-Shift-Enter, not just Enter

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



wrote in message
ups.com...
Hi...

How could I 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):

A B

day1 Mar
day2 May
day3 July
day5 Sep


Thanks!





All times are GMT +1. The time now is 05:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com