Forum Discussion
chemguy120
Apr 14, 2024Copper Contributor
Find All Rows With Same Date And Input A Value In Another Cell
So this one is a bit complicated (I think) and might need to be done through VBA. I need to do the following: 1. Find all of a earliest date in Column A 2. Enter the same number in Column B for ...
- Apr 14, 2024
=LET(rng,A1:A5000,
stacked,HSTACK(SORT(UNIQUE(rng)),SEQUENCE(COUNT(SORT(UNIQUE(rng))))),
BYROW(rng,LAMBDA(r,XLOOKUP(r,CHOOSECOLS(stacked,1),CHOOSECOLS(stacked,2)))))
Alternatively this formula returns the intended result in my Excel for the web sheet.
m_tarler
Apr 14, 2024Bronze Contributor
I think this will be doable with a formula but first please confirm that you have Excel 365.
Next i don't understand what numbers you want in column B but I think they are almost like a rank number for the dates. earliest date is X, next earliest is X+1, etc... where all dates that are the same get that same value.
so something like:
=XMATCH(A:A,SORT(UNIQUE(A:A)))+X
but replace A:A with the actual range and ideally use table range formatting like Table1[Date]
and replace X at the end with the offset you want to use (i.e. value -1 to be used for lowest date)
- chemguy120Apr 14, 2024Copper ContributorYes, I am using 365. The entered values would just be numbers in sequence. All of the first date would be "1", all of the next date would be "2", etc.