代码之家  ›  专栏  ›  技术社区  ›  Kolev_I_N

是否仅引入基于开始/结束日期的某些数据?

  •  0
  • Kolev_I_N  · 技术社区  · 1 周前

    我有一个公式,这里有人帮助我从多张表中引入数据。

    =filter(choosecols('Master Line List'!A:I,3,6,9,7,1), 'Master Line List'!I:I=C1, if(D1="All",'Master Line List'!G:G<>"",'Master Line List'!G:G=D1),
     byrow('Master Line List'!F:F,lambda(Σ,or(bycol(split(Σ,char(10)),lambda(Λ,isbetween(--left(Λ,find(" ",Λ)),G2,H2)))))))
    

    它工作得很好,但我想更进一步。计算表中的G2和H2是开始/结束日期。如果换行符中的任何一个日期包含G2和H2之间的日期,则THis当前会提取整个注释。

    是否可以只引入开始/结束日期内的注释,而排除较早的换行符?

    以下是我尝试的内容,但出现了公式解析错误

    =filter(
        choosecols('Master Line List'!A:I, 3, 6, 9, 7, 1),
        'Master Line List'!I:I = C1,
        if(D1 = "All", 'Master Line List'!G:G <> '', 'Master Line List'!G:G = D1),
        byrow(
            'Master Line List'!F:F,
            lambda(
                Σ,
                or(
                    bycol(
                        split(Σ, char(10)),
                        lambda(
                            Λ,
                            and(
                                isdate(--left(Λ, find(" ", Λ))),
                                isbetween(--left(Λ, find(" ", Λ)), G2, H2)
                            )
                        )
                    )
                )
            )
        ),
        'Master Line List'!F:F <> ""
    )
    

    Here is a link to my sheet with the expected result example to the right

    非常感谢您的帮助,谢谢!

    1 回复  |  直到 1 周前
        1
  •  0
  •   Argyll    1 周前

    您可以重复使用原始公式,如下所示

    =filter({choosecols('Master Line List'!A:I,3),map('Master Line List'!F:F,lambda(c,if(c="","",let(raw,split(c,char(10)),TF,map(raw,lambda(Λ,isbetween(--left(Λ,find(" ",Λ)),G2,H2))),join(char(10),filter(raw,TF)))))),choosecols('Master Line List'!A:I,9,7,1)}, 'Master Line List'!I:I=C1, if(D1="All",'Master Line List'!G:G<>"",'Master Line List'!G:G=D1),
     map('Master Line List'!F:F,lambda(Σ,or(bycol(split(Σ,char(10)),lambda(Λ,isbetween(--left(Λ,find(" ",Λ)),G2,H2)))))))
    

    将注释列替换为

    map('Master Line List'!F:F
       ,lambda(c,if(c=""
                   ,""
                   ,let(raw
                       ,split(c,char(10))
                       ,TF
                       ,map(raw
                           ,lambda(Λ,isbetween(--left(Λ,find(" ",Λ)),G2,H2))
                       ,join(char(10),filter(raw,TF))))))
    

    你已经知道怎么做了 map(raw,lambda(Λ,isbetween(--left(Λ,find(" ",Λ)),G2,H2)) 有效,它提取文本值到一个空格,然后将其转换为数字,然后通过询问它是否在日期范围内 isbetween .

    你只需要在此基础上过滤每条评论,然后 join 以合理的方式显示每个注释的结果,例如通过 char(10) .

    由于您已经为一个几乎相同的问题制定了一个有效的公式,我将把它留给您来减少重复的部分,并根据您的需要进行重组。


    enter image description here