Google sheets 如何正确排序此查询?

Google sheets 如何正确排序此查询?,google-sheets,google-sheets-query,Google Sheets,Google Sheets Query,我需要按M列对单元格I3中的查询进行正确排序 我有这个公式 =ArrayFormula(IFERROR(QUERY({ IFERROR(QUERY({A3:G},"Select Col1,Col2,Col3,'30',Col5 where Col5 contains 'Days' Label '30' '' ",0),{"","","","",""}); IFERROR(QUERY({A3:G},"Select Col1,Col2,Col3,'60',Col6 where Col6 contai

我需要按M列对单元格I3中的查询进行正确排序

我有这个公式

=ArrayFormula(IFERROR(QUERY({
IFERROR(QUERY({A3:G},"Select Col1,Col2,Col3,'30',Col5 where Col5 contains 'Days' Label '30' '' ",0),{"","","","",""});
IFERROR(QUERY({A3:G},"Select Col1,Col2,Col3,'60',Col6 where Col6 contains 'Days' Label '60' '' ",0),{"","","","",""});
IFERROR(QUERY({A3:G},"Select Col1,Col2,Col3,'90',Col7 where Col7 contains 'Days' Label '90' '' ",0),{"","","","",""})},
"Select * where Col1 is not null order by Col5",0),""))
我已经试了好几个小时了,运气不好

我为我需要的东西制作了一个标签“预期结果”

  • 字符串按字典顺序排序,即
    19天
    2天之前
    为1<2
  • 从第5列、第6列和第7列的数字中删除
    Days
    ,您的查询将正常工作
  • 您可以稍后为它们添加标签:
  • 或者,
    应以2或3位数字输入:
    19天
    02天

=ArrayFormula(IFERROR(QUERY({
IFERROR(QUERY({A3:G},"Select Col1,Col2,Col3,'30',Col5 where Col5 contains 'Days' Label '30' '' ",0),{"","","","",""});
IFERROR(QUERY({A3:G},"Select Col1,Col2,Col3,'60',Col6 where Col6 contains 'Days' Label '60' '' ",0),{"","","","",""});
IFERROR(QUERY({A3:G},"Select Col1,Col2,Col3,'90',Col7 where Col7 contains 'Days' Label '90' '' ",0),{"","","","",""})},
"Select Col1,Col2,Col3,Col4,Col5 where Col1 is not null format Col5 '0 Days' order by Col5",0),""))
=ARRAYFORMULA(QUERY({IFERROR(QUERY({
IFERROR(QUERY({A3:G},"select Col1,Col2,Col3,'30',Col5 where Col5 contains 'Days' Label '30' '' ",0),{"","","","",""});
IFERROR(QUERY({A3:G},"select Col1,Col2,Col3,'60',Col6 where Col6 contains 'Days' Label '60' '' ",0),{"","","","",""});
IFERROR(QUERY({A3:G},"select Col1,Col2,Col3,'90',Col7 where Col7 contains 'Days' Label '90' '' ",0),{"","","","",""})},
"Select * where Col1 is not null",0),""), 
VALUE(REGEXEXTRACT(IFERROR(QUERY({
IFERROR(QUERY({A3:G},"select Col1,Col2,Col3,'30',Col5 where Col5 contains 'Days' Label '30' '' ",0),{"","","","",""});
IFERROR(QUERY({A3:G},"select Col1,Col2,Col3,'60',Col6 where Col6 contains 'Days' Label '60' '' ",0),{"","","","",""});
IFERROR(QUERY({A3:G},"select Col1,Col2,Col3,'90',Col7 where Col7 contains 'Days' Label '90' '' ",0),{"","","","",""})},
"Select Col5 where Col1 is not null",0),""),"\d+"))}, "select Col1,Col2,Col3,Col4,Col5 order by Col6"))