formula for checking and write when a value last time appeared?

excelNewbie22

Well-known Member
Joined
Aug 4, 2021
Messages
510
Office Version
  1. 365
Platform
  1. Windows
hi,
is it possible by formula to check and write when the last time a number/value repeated?

example:
test
ABCD
1date#last time appearedbefore last time
215/04/2022686202/04/202224/03/2022
314/04/20228336xx
413/04/20225741xx
512/04/20226324xx
611/04/2022541427/03/2022x
710/04/20223336xx
809/04/20227384xx
908/04/20221315xx
1007/04/20222172xx
1106/04/20226617xx
1205/04/20223323xx
1304/04/20226728xx
1403/04/20225738xx
1502/04/20226862xx
1601/04/20226483xx
1731/03/20223172xx
1830/03/20225582xx
1929/03/20228648xx
2028/03/20226452xx
2127/03/20225414xx
2226/03/20224647xx
2325/03/20225575xx
2424/03/20226862xx
test
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
MrExcelPlayground8.xlsx
ABCD
1date#last time appearedbefore last time
24/15/202268624/2/20223/24/2022
34/14/20228336  
44/13/20225741  
54/12/20226324  
64/11/202254143/27/2022 
74/10/20223336  
84/9/20227384  
94/8/20221315  
104/7/20222172  
114/6/20226617  
124/5/20223323  
134/4/20226728  
144/3/20225738  
154/2/20226862  
164/1/20226483  
173/31/20223172  
183/30/20225582  
193/29/20228648  
203/28/20226452  
213/27/20225414  
223/26/20224647  
233/25/20225575  
243/24/20226862  
Sheet3
Cell Formulas
RangeFormula
C2:C24C2=IF(ISNA(MATCH(B2,B$1:B1,0)),IFNA(INDEX(A3:A$25,MATCH(B2,B3:B$25,0)),""),"")
D2:D24D2=IF(ISNA(MATCH(B2,B$1:B1,0)),IFNA(INDEX(A2:A$25,MATCH(B2,B3:B$25,0)+MATCH(B2,OFFSET(B2,MATCH(B2,B3:B$25,0)+1,0,ROWS(A2:A$24)-MATCH(B2,B3:B$25,0)-1),0)+1),""),"")
 
Upvote 0
Solution
How about:

Dante Amor
ABCD
1date#last time appearedbefore last time
215/04/2022686202/04/202224/03/2022
314/04/20228336xx
413/04/2022574109/04/202203/04/2022
512/04/20226324xx
611/04/2022541427/03/2022x
710/04/20223336xx
809/04/20225741xx
908/04/20221315xx
1007/04/20222172xx
1106/04/20226617xx
1205/04/20223323xx
1304/04/20226728xx
1403/04/20225741xx
1502/04/20226862xx
1601/04/20226483xx
1731/03/20223172xx
1830/03/20225582xx
1929/03/20228648xx
2028/03/20226452xx
2127/03/20225414xx
2226/03/20224647xx
2325/03/20225741xx
2424/03/20226862xx
Hoja1
Cell Formulas
RangeFormula
C2:D24C2=IF(AND(COUNTIF($B$2:$B$24,$B2)>COLUMNS($C$1:C$1),COUNTIF($B$1:$B1,$B2)=0),LARGE(INDEX(($B2=$B$2:$B$24)*$A$2:$A$24,),COLUMNS($C$1:C$1)+1),"x")
 
Upvote 0
JamesCanale:
it works fine but after i apply the formula to the all column and try to modify a cell, for example b11 to match b9, the formula in c9 do not change

test.xlsx
ABCD
1date#last time appearedbefore last time
215/04/2022686202/04/202224/03/2022
314/04/20228336  
413/04/20225741  
512/04/20226324  
611/04/2022541427/03/2022 
710/04/20223336  
809/04/20227384  
908/04/20221315  
1007/04/20222172  
1106/04/20221315  
1205/04/20223323  
1304/04/20226728  
1403/04/20225738  
1502/04/20226862  
1601/04/20226483  
1731/03/20223172  
1830/03/20225582  
1929/03/20228648  
2028/03/20226452  
2127/03/20225414  
2226/03/20224647  
2325/03/20225575  
2424/03/20226862  
test
Cell Formulas
RangeFormula
C2:C24C2=IF(ISNA(MATCH(B2,B$1:B1,0)),IFNA(INDEX(A3:A$25,MATCH(B2,B3:B$25,0)),""),"")
D2:D24D2=IF(ISNA(MATCH(B2,B$1:B1,0)),IFNA(INDEX(A2:A$25,MATCH(B2,B3:B$25,0)+MATCH(B2,OFFSET(B2,MATCH(B2,B3:B$25,0)+1,0,ROWS(A2:A$24)-MATCH(B2,B3:B$25,0)-1),0)+1),""),"")



DanteAmor:
it works good as well but some of the dates are wrong

test.xlsx
ABCD
1date#last time appearedbefore last time
215/04/2022686202/04/202224/03/2022
314/04/20228336xx
413/04/20225741xx
512/04/20226324xx
611/04/2022541427/03/2022x
710/04/20223336xx
809/04/20227384xx
908/04/2022131500/01/1900x
1007/04/20222172xx
1106/04/20221315xx
1205/04/20223323xx
1304/04/20226728xx
1403/04/20225738xx
1502/04/20226862xx
1601/04/20226483xx
1731/03/20223172xx
1830/03/20225582xx
1929/03/20228648xx
2028/03/20226452xx
2127/03/20225414xx
2226/03/20224647xx
2325/03/20225575xx
2424/03/20226862xx
test
Cell Formulas
RangeFormula
C2:D24C2=IF(AND(COUNTIF($B$2:$B$24,$B2)>COLUMNS($C$1:C$1),COUNTIF($B$1:$B1,$B2)=0),LARGE(INDEX(($B2=$B$2:$B$24)*$A$2:$A$24,),COLUMNS($C$1:C$1)+1),"x")
 
Upvote 0
I made that change on mine and it worked:

MrExcelPlayground8.xlsx
ABCD
1date#last time appearedbefore last time
24/15/202268624/2/20223/24/2022
34/14/20228336  
44/13/20225741  
54/12/20226324  
64/11/202254143/27/2022 
74/10/20223336  
84/9/20227384  
94/8/202213154/6/2022 
104/7/20222172  
114/6/20221315  
124/5/20223323  
134/4/20226728  
144/3/20225738  
154/2/20226862  
164/1/20226483  
173/31/20223172  
183/30/20225582  
193/29/20228648  
203/28/20226452  
213/27/20225414  
223/26/20224647  
233/25/20225575  
243/24/20226862  
Sheet3
Cell Formulas
RangeFormula
C2:C24C2=IF(ISNA(MATCH(B2,B$1:B1,0)),IFNA(INDEX(A3:A$25,MATCH(B2,B3:B$25,0)),""),"")
D2:D24D2=IF(ISNA(MATCH(B2,B$1:B1,0)),IFNA(INDEX(A2:A$25,MATCH(B2,B3:B$25,0)+MATCH(B2,OFFSET(B2,MATCH(B2,B3:B$25,0)+1,0,ROWS(A2:A$24)-MATCH(B2,B3:B$25,0)-1),0)+1),""),"")
 
Upvote 0
DanteAmor:
it works good as well but some of the dates are wrong


I'm testing with the same data and I'm having no problems:
Dante Amor
ABCD
1date#last time appearedbefore last time
215/04/2022686202/04/202224/03/2022
314/04/20228336xx
413/04/20225741xx
512/04/20226324xx
611/04/2022541427/03/2022x
710/04/20223336xx
809/04/20227384xx
908/04/2022131506/04/2022x
1007/04/20222172xx
1106/04/20221315xx
1205/04/20223323xx
1304/04/20226728xx
1403/04/20225738xx
1502/04/20226862xx
1601/04/20226483xx
1731/03/20223172xx
1830/03/20225582xx
1929/03/20228648xx
2028/03/20226452xx
2127/03/20225414xx
2226/03/20224647xx
2325/03/20225575xx
2424/03/20226862xx
Hoja1
Cell Formulas
RangeFormula
C2:D24C2=IF(AND(COUNTIF($B$2:$B$24,$B2)>COLUMNS($C$1:C$1),COUNTIF($B$1:$B1,$B2)=0),LARGE(INDEX(($B2=$B$2:$B$24)*$A$2:$A$24,),COLUMNS($C$1:C$1)+1),"x")


Review the formula. If you have problems, comment on what date you have a problem with and what result it should have.
 
Upvote 0
sorry for the late reply,
JamesCanale and DanteAmor
strange,
for both your formulas,
when trying to modify a number like at b9 it works and c9 change/date fixed
but if i try to modify the number at b11 first then c9 stays blank/date wrong
same goes for each number
i think it something with my excel file

so i test it with another
and all good
who do i give the feedback to?
 
Upvote 0
by feedback i mean marking as solution,
i supposed i'll marked the first one
BUT BOTH OF YOU WORKS GOOD!!
T-H-A-N-K Y-O-U!
 
Upvote 0
Here are a couple of alternatives that I think also do what you want

22 04 17.xlsm
ABCD
1date#last time appearedbefore last time
215/04/2022686202/04/202224/03/2022
314/04/20228336xx
413/04/20225741xx
512/04/20226324xx
611/04/2022541427/03/2022x
710/04/20223336xx
809/04/20227384xx
908/04/20221315xx
1007/04/20222172xx
1106/04/20226617xx
1205/04/20223323xx
1304/04/20226728xx
1403/04/20225738xx
1502/04/20226862xx
1601/04/20226483xx
1731/03/20223172xx
1830/03/20225582xx
1929/03/20228648xx
2028/03/20226452xx
2127/03/20225414xx
2226/03/20224647xx
2325/03/20225575xx
2424/03/20226862xx
Last Time & Time Before
Cell Formulas
RangeFormula
C2:C24C2=IF(COUNTIF(B$2:B2,B2)=1,IFERROR(AGGREGATE(14,6,A3:A$100/(B3:B$100=B2),1),"x"),"x")
D2:D24D2=IF(C2="x","x",IFERROR(AGGREGATE(14,6,A3:A$100/(B3:B$100=B2),2),"x"))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,892
Members
449,058
Latest member
Guy Boot

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