Formula for tabulating daily running counts of a given column

依然范特西╮ 提交于 2021-02-10 23:17:27

问题


I'm trying to write a formula that gives a running count of Issues for a given day. In other words: the output should enumerate each Issue for a given date (returning blank if Issue is blank), and then start again at 1 for the first issue in a subsequent date.

I've hard-coded the expected outputs in the "desired output" column (column I):


Sample dataset is in this sheet. Key pieces:

  • Column B contains the date
  • Column E contains the T-shirt size severity of each Issue
  • Column F contains a numerical translation of column E
  • Column G contains a binary output of whether there was an Issue

In my attempt (column J), I've gotten close using

=ArrayFormula(MMULT((ROW($B3:$B)>=TRANSPOSE(ROW($B3:$B))) * EXACT($B3:$B,TRANSPOSE($B3:$B))^1, ($G3:$G)^1))

...but it's not quite what I want, as:

  1. this repeats values instead of giving blanks (e.g. row 8, 11)
  2. this gives 0s instead of giving blanks (e.g. row 3, 4)

See Validation (column L).


Any ideas on how to get to what I'm looking for?


回答1:


Just wrap your formula in the IF function

=ArrayFormula(IF(F3:F="",,YOUR.....FORMULA))

In other words

=ArrayFormula(IF(F3:F="",, 
                   MMULT((ROW($B3:$B)>=TRANSPOSE(ROW($B3:$B))) * EXACT($B3:$B,TRANSPOSE($B3:$B))^1, ($G3:$G)^1) 
                      ))


来源:https://stackoverflow.com/questions/63893967/formula-for-tabulating-daily-running-counts-of-a-given-column

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!