简体   繁体   English

计算列中一系列类别的中位数-Excel

[英]Calculating the median across a range of categories in columns - Excel

So in our experiment we took several samples from a number of fields. 因此,在我们的实验中,我们从多个领域中抽取了几个样本。 In each of these areas we counted the number of clover plants and their sizes. 在每个区域中,我们都计算了三叶草的数量及其大小。 So each row of the table is one sample with how many size1, size2 (etc) plants appeared in that sample. 因此,表格的每一行都是一个样本,该样本中出现了多少个size1,size2(等)植物。 So I want to know whether there is a code that I can put into column G that will work out what the median size class is. 因此,我想知道是否可以将代码放入G列中,以计算出中位数大小类。

For example, Column G would show 'size1' for Row 7, because it is the middle value if the data were lined up (size1, size1, size1, size2,size4). 例如,第G列的第7行将显示“ size1”,因为如果将数据(size1,size1,size1,size2,size4)排成一行,它就是中间值。

我们的数据

Again I'm sorry if I'm making a total pig's ear of this. 再次抱歉,我对此一无所知。 Stats seems to be very good at stumping me at the simplest things. Stats似乎非常擅长让我不了解最简单的事情。

If you're trying to return the column header from the column that has a non-zero number, you can use this in G2 , and drag down: 如果您尝试从具有非零数字的列中返回列标题,则可以在G2使用它并向下拖动:

=INDEX($B$1:$F$1,SUMPRODUCT(MAX(($B2:$F2<>0)*(COLUMN($B2:$F2))))-COLUMN($B$1)+1)

在此处输入图片说明

Note you can wrap that in IFERROR([formula], "") to hide the error that occurs if there's not a cell that's not equal to 0 . 请注意,您可以将其包装在IFERROR([formula], "")以隐藏没有一个不等于0的单元格时发生的错误。

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

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