我想识别重复项并保留最新的重复项,然后在Google表格中删除其他重复项

时间:2019-04-27 23:22:15

标签: sorting google-sheets duplicates google-sheets-formula google-sheets-query

我希望识别出重复的数据。有了这些数据后,我想按日期对重复项进行排序,并保留最新的。

由于内部敏感信息,我无法提供工作表的副本。

1 个答案:

答案 0 :(得分:0)

这样做:

=ARRAYFORMULA(IFERROR(VLOOKUP(UNIQUE(B:B), 
 QUERY({A:B}, "select Col2,Col1 
               order by toDate(Col1) desc
               format Col1 'dd/mm/yyyy' ", 0), {2, 1}, 0)))

0


=ARRAYFORMULA(QUERY(IFERROR(VLOOKUP(UNIQUE(QUERY({Data!A:H}, 
 "select Col3
  where toDate(Col5) >= date '"&TEXT(A1, "yyyy-mm-dd")&"' 
    and toDate(Col5) <= date '"&TEXT(B1, "yyyy-mm-dd")&"'
  order by toDate(Col1) desc ", 0)), 
 QUERY({Data!A:H}, 
 "select Col3,Col1,Col2,Col4,Col5,Col6,Col7 
  where toDate(Col5) >= date '"&TEXT(A1, "yyyy-mm-dd")&"' 
    and toDate(Col5) <= date '"&TEXT(B1, "yyyy-mm-dd")&"'
  order by toDate(Col1) desc
  format Col5 'mm/dd/yyyy' ", 0), {2,3,1,4,5,6,7}, 0)),
 "format Col1 'yyyy-nn-dd hh:mm:ss', Col5 'mm/dd/yyyy'"))

0


=ARRAYFORMULA(QUERY(IFERROR(VLOOKUP(UNIQUE(QUERY({Data!A:H}, 
 "select Col2
  where toDate(Col5) >= date '"&TEXT(A1, "yyyy-mm-dd")&"' 
    and toDate(Col5) <= date '"&TEXT(B1, "yyyy-mm-dd")&"'
  order by toDate(Col1) desc ", 0)), 
 QUERY({Data!A:H}, 
 "select Col2,Col1,Col3,Col4,Col5,Col6,Col7 
  where toDate(Col5) >= date '"&TEXT(A1, "yyyy-mm-dd")&"' 
    and toDate(Col5) <= date '"&TEXT(B1, "yyyy-mm-dd")&"'
  order by toDate(Col1) desc
  format Col5 'mm/dd/yyyy' ", 0), {2,1,3,4,5,6,7}, 0)),
 "format Col1 'yyyy-mm-dd hh:mm:ss', Col5 'mm/dd/yyyy'"))
相关问题