Google表格-自上次日期以来的天数,一系列单元格

时间:2019-03-21 13:43:48

标签: if-statement google-sheets google-sheets-formula google-sheets-query

我知道如何返回特定日期的天数,这需要输入一个单元格。事实是,我要发送的电子邮件列表不断增加(在新列中),因此日期需要用新列更新。

如果2列中有2个日期,公式可以像=minus(TODAY(), between B6 and D6)一样吗?

使用电子表格链接进行测试-https://docs.google.com/spreadsheets/d/1dQNMMiSvfGNSj5mJ4Uu8kbEATPSS35_Cd-wbbfrrGPM/edit?usp=sharing

3 个答案:

答案 0 :(得分:1)

尝试这样:

=DAYS(TODAY(), D6)

0

或者像这样:

=DAYS(TODAY(), MAX(B6:D6))

0

答案 1 :(得分:0)

  

我希望现在稍微提高一点。我希望知道当A列中的名称相同时,从第一个或最后一个订单到下一个订单的日期。

粘贴到 C2 单元格中并向下拖动:

=IF(LEN(A2&B2), 
 IF(COUNTIF(INDIRECT("A2:A"&ROW()), INDIRECT("A2:A"&ROW()))>1, 
 DAYS(B2, MAX(QUERY({INDIRECT("A2:B"&ROW()-1)}, 
 "select Col2 where Col1 ='"&A2&"'", 0))), "1st Order"), )

0

答案 2 :(得分:0)

要获取每行的最大值:

SELECT E.EMPLID AS [EE ID]
    ,E.Name AS [Name]
    ,E.EFFDT AS [Eff Date]
    ,E.COMPANY AS [Co.]
    ,E.JOBCODE AS [Job Code]
    ,E.JOBTITLE [Title]
    ,(SELECT TOP 1 J.GRADE
        FROM JobCodeTable AS J
        WHERE E.JOBCODE = J.JOBCODE
        AND
        E.EFFDT >= J.EFFDT
        ORDER BY J.EFFDT DESC
    ) AS [MRR]
    ,(SELECT TOP 1 J.BONUS
        FROM JobCodeTable AS J
        WHERE E.JOBCODE = J.JOBCODE
        AND
        E.EFFDT >= J.EFFDT
        ORDER BY J.EFFDT DESC
    ) AS [Bonus]
    ,(SELECT TOP 1 J.OCC_TYPE
        FROM JobCodeTable AS J
        WHERE E.JOBCODE = J.JOBCODE
        AND
        E.EFFDT >= J.EFFDT
        ORDER BY J.EFFDT DESC
    ) AS [OCC]
    ,E.EMPL_STATUS_DESC AS [Status]
FROM Employee History AS [E]
WHERE E.EMPL_STATUS_DESC = 'Active'
    AND
    E.EFFDT >= '2019-01-01'

或者,根据行(名称,组等)的标签获取最大值

=Today()-Max(B6:D6)

如果再添加一张汇总的+唯一值,则后者将非常有用。