简体   繁体   English

如何通过比较具有相同“ID”列的另一列中的值来标记单元格?

[英]How do you flag cells by comparing values in another column with the same 'ID' column?

I have a sample table like this:我有一个这样的示例表:

base根据

1个

I wanted to flag if there is an increase in Output of the same ID compared to the previous Date.我想标记相同 ID 的 Output 与上一个日期相比是否有所增加。 Note that the data is only sorted by Date .请注意,数据仅按日期排序

Expected output: output预计 output: output

2个

I've been trying to find the correct formula so that it only compares between current output with previous output of the same ID in previous date with INDEX-MATCH functions and had no luck.我一直在尝试找到正确的公式,以便它只比较当前 output 与之前日期相同 ID 的 output与 INDEX-MATCH 函数之间的比较,但没有运气。 Thank you for your assistance.谢谢您的帮助。

=IF(AND(D2>INDEX($D$2:$D$9, MATCH(C2,$C$2:$C$9,0)-1), C2=INDEX($C$2:$C$9, MATCH(B2,$B$2:$B$9,0)-1)), "Flag", "")

Try the following formula-试试下面的公式-

=IF(C2>TAKE(TAKE(FILTER($C$2:$C2,$B$2:$B2=B2,0),-2),1),"Flag","")

在此处输入图像描述

The following is an array approach.以下是数组方法。 In cell D2 use the following formula:在单元格D2中使用以下公式:

=LET(A, A2:A9, B, B2:B9, C, C2:C9, MAP(A, B,C, LAMBDA(aa,bb,cc, LET(
  f, FILTER(C, (B=bb) * (A < aa),""), IF(OR(@f="", TAKE(f,-1)>=cc),"", "Flag")))))

Here is the output:这是 output: excel输出

On each MAP iteration we filter Output column ( C ) by ID ( B ) equals to bb and only previous dates.在每次MAP迭代中,我们通过等于bbID ( B ) 过滤Output列 ( C ) 并且仅过滤之前的日期。 To select filtered the output ( f ) that corresponds to previous date we use: TAKE(f,-1) , ie select the last filtered row (data is sorted by date in ascending order).对于 select 过滤了对应于上一个日期的 output ( f ) 我们使用: TAKE(f,-1) ,即 select 最后过滤的行(数据按日期升序排列)。 Then we check for empty condition: the filter result is empty ( @f="" ), ie no result returned under filter condition or the output is not ascending.然后我们检查空条件:过滤结果为空( @f="" ),即过滤条件下没有返回结果或者output没有升序。

暂无
暂无

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

相关问题 将一列单元格与另一列单元格进行比较 - Comparing one column of cells to another 如果另一列中的值相同,如何合并一列的单元格? , 我的公式不起作用 - How do I Merge one column's cells if values in another column is same? , My formula isn't working 如何在将列的单元格的值与字符串进行比较时排除列的活动单元格的第一个单元格 - How to exclude first cell of the active cells of a column while comparing the values of the cells of the column with a string 如何通过比较另一列中的某些值在Google电子表格列中求和? - How to sum in google spreadsheet column by comparing some of the values in another column? 比较列中的单元格并将值写入新列 - Comparing Cells in Columns and Writing Values to a New Column 如何在跳过空白单元格的同时将一张工作表中的一列复制到另一张工作表中的另一列? - How do you copy one column in one sheet to another column in a different sheet, while skipping over blank cells? 比较列中的单元格 (VBA) - Comparing cells in a column (VBA) 将单元格与单元格比较,当同一列中的所有单元格相等时,删除整列 - Comparing cells to cells, when all the cells in the same column is equal, delete the whole column 当必须使用同一列中的不同值填充单元格时,如何填充此列中的空白单元格? - How to fill in blank cells in this column, when the cells have to be populated with different values from this same column? 如何在 excel 列中添加值? - How do you add values in excel column?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM