Get the last non-empty cell in a column in Google Sheets

后端 未结 16 2195
温柔的废话
温柔的废话 2020-11-28 21:04

I use the following function

=DAYS360(A2, A35)

to calculate the difference between two dates in my column. However, the column is ever exp

相关标签:
16条回答
  • 2020-11-28 21:44

    To find last nonempty row number (allowing blanks between them) I used below to search column A.

    =ArrayFormula(IFNA(match(2,1/(A:A<>""))))
    
    0 讨论(0)
  • 2020-11-28 21:47

    The way an amateur does it is "=CONCATENATE("A",COUNTUNIQUE(A1:A9999))", where A1 is the first cell in the column, and A9999 is farther down that column than I ever expect to have any entries. This resultant A# can be used with the INDIRECT function as needed.

    0 讨论(0)
  • 2020-11-28 21:51

    for a row:

    =ARRAYFORMULA(INDIRECT("A"&MAX(IF(A:A<>"", ROW(A:A), ))))
    

    for a column:

    =ARRAYFORMULA(INDIRECT(ADDRESS(1, MAX(IF(1:1<>"", COLUMN(1:1), )), 4)))
    
    0 讨论(0)
  • 2020-11-28 21:51

    Calculate the difference between latest date in column A with the date in cell A2.

    =MAX(A2:A)-A2
    
    0 讨论(0)
  • 2020-11-28 21:54

    What about this formula for getting the last value:

    =index(G:G;max((G:G<>"")*row(G:G)))
    

    And this would be a final formula for your original task:

    =DAYS360(G10;index(G:G;max((G:G<>"")*row(G:G))))
    

    Suppose that your initial date is in G10.

    0 讨论(0)
  • 2020-11-28 21:54

    This seems like the simplest solution that I've found to retrieve the last value in an ever-expanding column:

    =INDEX(A:A,COUNTA(A:A),1)
    
    0 讨论(0)
提交回复
热议问题