如何在数组公式中使用过滤器? [英] How to use a filter inside an array formula?

查看:95
本文介绍了如何在数组公式中使用过滤器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个注销表单,我想知道哪些只用公式。



我的思考过程是找到每个标签的最后一个实例,并且如果out行号高于in行号,则设备当前被签出。

 时间戳学生姓名签出Chromebook签入Chromebook 
2015/2/26 10:33:48 Bjorn Spare1-01
2/26/2015 10:33:59 Fred Spare1-02
2/26/2015 10:34:16 Bjorn Spare1-01
2015/2/26 10:34:39 Conor Spare1-03
2015/2/26 11:57:31 Conor Spare1-01
2/26/2015 11:57:49 Fred Spare1-02
2/26/2015 11:57:59 Bjorn Spare1-02

我可以找到所有已使用的备件: = sort(UNIQUE(C2:C))



我已经能够找到最后一个的行号每行使用: = max(filter(row(C:C),C:C = F2))(我的排序唯一函数在F列中)。



我想让我的最后一行公式与arrayformula一起工作,这样我就不必依靠手动拖动公式了。



例如,我希望这样做: = arrayformula(max(filter(row(C:C),C:C = F: F)))注意添加了arrayformula以及从F:2到F:F的变化。



我不太清楚为什么,但我得到1000的结果。



编辑:我的预期输出会

 退出唯一上次结帐行
Spare1-01 6
Spare1- 02 8
Spare1-03 5

如果我能算出将它添加到数组中公式我也想找到一种方法来放入排序(独特的功能,使它成为一个单一的公式,我输入列号,它吐出每个唯一条款的最后一行号码)。



以下是我正在使用的文档的链接: https://docs.google.com/spreadsheets/d/1jC0RPxUZSt7BCHRQI5vBXvoANbQlu9CjDNr2VV-MOOI/edit?usp=sharing



编辑(使用的最终公式)(我无法感谢@JVP足够的帮助):

  = ArrayFormula(if (VLOOKUP(U nique(filter(C2:C,len(C2:C))),sort({C2:C,A2:B,row(A2:A)},4,0),4,0)> iferror(vlookup(unique(filter(C2:C,len(C2:C))),sort({D2:D,A2:B,row(A2:A)},4,0),4,0), 0),vlookup(unique(filter(C2:C,len(C2:C))),sort({C2:C,A2:C,row(A2:A)},5,0),{2,4 ,3},0),))


解决方案

所需输出(包括名称),请尝试:

  = ArrayFormula({unique(filter(C2:C,len(C2: (C2:C)),sort({C2:C,A2:B,row(A2:A)},4,0),4, 0)})

按照您的思考过程(最终您想要查看当前是否检入了设备),请尝试:

$ $ p $ code $ = ArrayFormula({unique(filter(C2:C,len(C2:C )),if(vlookup(unique(filter(C2:C,len(C2:C))),sort({C2:C,A2:B,row(A2:A)},4,0),4 ,0)> iferror(vlookup(unique(filter(C2:C,len(C2:C))),sort({D2:D,A2:B,row(A2:A)},4,0) 4),0),check out,check in)})

< a href =https://docs.google.com/a/open-school.be/spreadsheets/ d / 1birtMD1d-h-vOyybt0ofTh8Yzp-eFT2X5bPsw1xyrVk / edit?usp = sharingrel =nofollow>带F2中最后一个公式的示例表


I have a sign-out form that I want to find out which ones are out using just formulas.

My thought process is to find the row number of the last instance of each label and if the "out" row number is higher than the "in" row number then the device is currently checked out.

Timestamp   Student     Name    Check out Chromebook    Check in Chromebook
2/26/2015   10:33:48    Bjorn   Spare1-01   
2/26/2015   10:33:59    Fred    Spare1-02   
2/26/2015   10:34:16    Bjorn                           Spare1-01
2/26/2015   10:34:39    Conor   Spare1-03   
2/26/2015   11:57:31    Conor   Spare1-01   
2/26/2015   11:57:49    Fred                            Spare1-02
2/26/2015   11:57:59    Bjorn   Spare1-02   

I am able to find find out all spares that have been checked out using: =sort(UNIQUE(C2:C))

I have been able to find the row number of the last instance of each using: =max(filter(row(C:C),C:C=F2)) (my sort unique function is in column F).

I would like to get my last row formula to work with an arrayformula so that I don't have to rely on manually dragging the formula down.

For example I would like this to work: =arrayformula(max(filter(row(C:C),C:C=F:F))) note the addition of arrayformula and the change from F:2 to F:F.

I am not quite sure why but I get a result of 1000.

Edit: My expected output would be "Last checkout row".

Out Unique  Last checkout row
Spare1-01   6
Spare1-02   8
Spare1-03   5

If I can figure out the adding it to the array formula I would also like to find a way to put in the sort (unique function so that it becomes a single formula which I enter in the column number and it spits out the last row numbers of each unique term).

Here is a link to a document that I am playing with: https://docs.google.com/spreadsheets/d/1jC0RPxUZSt7BCHRQI5vBXvoANbQlu9CjDNr2VV-MOOI/edit?usp=sharing

Edit (final formula used) (I can't thank @JVP enough for the help with this):

=ArrayFormula( if(vlookup(unique(filter(C2:C, len(C2:C))), sort({C2:C, A2:B, row(A2:A)},4,0), 4, 0) > iferror(vlookup(unique(filter(C2:C, len(C2:C))), sort({D2:D, A2:B, row(A2:A)},4,0),4,0),0), vlookup(unique(filter(C2:C, len(C2:C))), sort({C2:C, A2:C, row(A2:A)},5,0), {2,4,3}, 0), ))

解决方案

For your desired output (including the names), try:

=ArrayFormula({unique(filter(C2:C, len(C2:C))), vlookup(unique(filter(C2:C, len(C2:C))), sort({C2:C, A2:B, row(A2:A)},4,0), 4, 0)})

Following your thought process (ultimately you want to see if a device is currently checked in or out, right ?), try:

=ArrayFormula({unique(filter(C2:C, len(C2:C))), if(vlookup(unique(filter(C2:C, len(C2:C))), sort({C2:C, A2:B, row(A2:A)},4,0), 4, 0) > iferror(vlookup(unique(filter(C2:C, len(C2:C))), sort({D2:D, A2:B, row(A2:A)},4,0),4,0),0), "checked out", "checked in")})

Example sheet with last formula in F2

这篇关于如何在数组公式中使用过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆