简体   繁体   English

Excel-计算随时间变化的发病率和患病率的最简单方法是什么?

[英]Excel - What is the easiest way to calculate incidence plus prevalence over time?

Say I have the dataset below, what is the most efficient formula to fill the cells in column D, where the number of patients alive are calculated? 假设我有以下数据集,填充D列中计算存活患者数的最有效公式是什么?

Example data set in excel Excel中的示例数据集

The way it should calculate is: 它应该计算的方式是:

month 1: 8*100% = 8 第1个月:8 * 100%= 8

Month 2: 8*80%+6*100% = 12.4 第二个月:8 * 80%+ 6 * 100%= 12.4

Month 3: 8*75%+6*80%+9*100% = 19.8 第3个月:8 * 75%+ 6 * 80%+ 9 * 100%= 19.8

... ...

Month 10: etc. 第10个月:等

The problem that I have is that which each row, the formula becomes longer. 我的问题是公式的每一行都会变长。 It is feasible to just manually enter the formulas for small datasets, but as datasets become larger, this task becomes unfeasible. 仅为小型数据集手动输入公式是可行的,但是随着数据集变大,此任务变得不可行。

I have been able to use VBA to code the survival of the number of new patients column (C). 我已经能够使用VBA来编码新患者存活数列(C)。 But then I would have to rerun the VBA code as soon as I change a single value in that column. 但是一旦更改了该列中的单个值,我就必须重新运行VBA代码。

I have a feeling it should be possible with some combination of the INDEX function in excel, I just haven't been able to figure it out. 我觉得在excel中结合使用INDEX函数应该是可能的,但我只是无法弄清楚。

Who can help me out here? 谁可以在这里帮助我?

Kind regards, Sander 亲切的问候,桑德

If moving the data a bit is allowed at least for the calculation, you could do something like this: 如果至少允许稍微移动数据进行计算,则可以执行以下操作:

=SUMPRODUCT($F$11:$F$20,B2:B11)

It uses a reversed list of your current list of new patients. 它使用您当前的新患者列表的反向列表。 That list is created with (formula obtained from this site ): 该列表是使用(从此站点获得的公式)创建的:

=INDEX($C$11:$C$20,COUNTA($C$11:$C$20)+ROW($C$11:$C$20)-ROW())

Result: 结果:

在此处输入图片说明

The added space is necessary for the formula to work (so that it gets 0% for patients not present yet). 要使该公式起作用,需要增加空间(因此对于尚不存在的患者,该空间为0%)。


Or one where you don't have to leave spaces (everything from above is reversed however): 或者,您不必留空格的地方(但是,上面的所有内容都是相反的):

=SUMPRODUCT($C$2:$C$11,G11:G20)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM