我想识别重复项并保留最新版本并删除Google表格中的其他内容

问题描述 投票:0回答:1

我希望在我的数据中找到重复项。一旦我有这些数据,我想按日期对重复项进行排序并保留最新的数据。

由于里面的敏感信息,我不能提供我的工作表的副本。

sorting google-sheets duplicates google-sheets-formula google-sheets-query
1个回答
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'"))
© www.soinside.com 2019 - 2024. All rights reserved.