Calculate Occurrence Number - Excel

前端 未结 3 1338
小鲜肉
小鲜肉 2021-01-28 18:12

I have simple problem, but I\'ve not be able to get an answer from searching. I require a column to calculate the number of the nth occurrence of a value. It\'s best explained i

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-28 18:48

    Are you looking to merely provide a count of the distinct entries of column A in column B? Or merely add a formula to come up with the table in your link?

    If the latter, then the formula to write in cell B2 is:

    =COUNTIF(A$2:A2,A2)
    

    then copy/paste it down column B. Note - if your data is both a Date and Time, but the cell is formatted to only display a date, you may not get the results you want. You'd need to interject a new column with a "floor" calculation to round the date/time value to a date (Excel date times are decimal, with integer part dictating the date, and remaining 0.0 -> 1.0 dictating the time of day)

    If you just want to derive a table of the counts of distinct entries in column A, then a pivot table will do this for you - simple add a pivot table to cover the data in column A, then select column A into the rows category, and then also drag it into the values category, ensuring the field is set to "Count of". You should then have a table with the distinct entries in your data set in one column, and the count of their occurrences in the other column.

提交回复
热议问题