In the attached picture, i have a column C with unique fruit names and Column A with fruit names appearing multiple times. How do i get the number of occurrences of each fruit with the number in column B. eg) Mango is appearing in the first place so its value is 1, then again Mango appears in the 3rd row so its value is 2, again Mango is in the 6th place so its value is 3 etc.... likewise for all the fruits. Please let me know if there is any excel or macro solution for this.
CodePudding user response:
You can put the following formula in B2: =COUNTIF($A$2:A2,A2)
and drag down.
The range to count the fruit extends to the row where the formula is (first part of formula) - and then counts the specific fruit (given in the second part) within that range.