Excel - Unique text formula
On March 30,2023 by Tom RoutleyIssue
I have 2 columns of names in columns a & b and a list of dates in column c. Column A has a unique name in each cell. Column B had the same 5 or 6 names next to each name in column A.
Column C is the date the name was added to the list. I need a formula to tell me how many unique names in column a were added by a user in column B before the date in column C.
I've read on 'Count the number of unique values by using functions' & 'Count how often multiple number values occur by using functions' but can't get it. Any help offered would be greatly appreciated. Thanks in advance.
client added by date added how many added before 'date added' george james 1/10/10 12:00 PM answer here should be 0 royale james 1/11/10 2:00 PM answer here should be 1 walt james 1/11/10 12:00 PM answer here should be 2 aj john 1/13/10 4:00 PM answer here should be 0 justin james 1/14/10 9:00 AM answer here should be 3 tam john 1/15/10 10:00 AM answer here should be 1 client george royale walt aj justin tam added by james james james john james john date added 1/10/10 12:00 PM 1/11/10 2:00 PM 1/11/10 12:00 PM 1/13/10 4:00 PM 1/14/10 9:00 AM 1/15/10 10:00 AM how many added before 'date added' answer here should be 0 answer here should be 1 answer here should be 2 answer here should be 0 answer here should be 3 answer here should be 1
Solution
It will first sort on the name who added, then by date and then by client. If you want to see it back in old sort order, you can add rows number to each row before and once macro is done, re-sort of the row number.
But if sort is nothing big, then u can use it as is
Cells.Select Selection.Sort _ Key1:=Range("B2"), Order1:=xlAscending, _ Key2:=Range("C2"), Order2:=xlAscending, _ Key3:=Range("A2"), Order3:=xlAscending, _ Header:=xlYes, OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal, _ DataOption2:=xlSortNormal, _ DataOption3:=xlSortNormal lrow = 2 AddedByName = Cells(lrow, 2) addCount = -1 Do While Cells(lrow, 1) <> "" If (AddedByName <> Cells(lrow, 2)) Then addCount = -1 AddedByName = Cells(lrow, 2) End If addCount = addCount + 1 Cells(lrow, 4) = addCount lrow = lrow + 1 Loop
Note
Thanks to RIZVISA1 for this tip on the forum.
Article Recommendations
Latest articles
Popular Articles
Archives
- November 2024
- October 2024
- September 2024
- August 2024
- July 2024
- June 2024
- May 2024
- April 2024
- March 2024
- February 2024
- January 2024
- December 2023
- November 2023
- October 2023
- September 2023
- August 2023
- July 2023
- June 2023
- May 2023
- April 2023
- March 2023
- February 2023
- January 2023
- December 2022
- November 2022
- October 2022
- September 2022
- August 2022
- July 2022
- June 2022
- May 2022
- April 2022
- March 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
- January 2021
Leave a Reply