Search code examples
excelexcel-formulaexcel-2010excel-2007

How to calculate unique ID's in Microsoft Excel?


I have an excel sheet which contains 4 years data of schools. The data set contains school scores. Old schools have data for 3 or 4 years of data while new schools have only 1 or 2 years of data.

I have a column in my data set which represents the unique school ID's. Based on these school ID's I want to generate a column "Occurrence" which represents the number of times each unique id occurred in the data set. I am attaching a picture which shows clearly what I want to have in the occurrence column by using formula. View my data set


Solution

  • In G2 use:

    =IF(COUNTIF(B$2:B2,B2)=1,COUNTIF(B:B,B2),"")
    

    Drag down.