Forum Discussion

ajl_ahmed's avatar
ajl_ahmed
Iron Contributor
Nov 15, 2024

Get a value from Range

Hi

Currently, I am using goole sheet.

I need a function to get last date of update.

Last date of update means the latest date from range (C7:H7) of the following conditions:

  • the last column in the range (C9:H18) contains data (Text, number) or
  • the last cell in the range (C5:H5) is (true) or
  • the last cell in the range (C6:H6) is (true) or
  • the last cell in the range (C8:H8 is (true) .

Note that:

  1. Range (C9:H18) contain a condition function (if).
  2. I tries this function =iferror(MAX(filter(C7:H7, (bycol(C9:H18, lambda(C, counta(C))))+(C5:H5=TRUE)+(C6:H6=TRUE)+(C8:H8=TRUE))),"No Update") but returned wrong date.

Please consider this Google sheet link

https://docs.google.com/spreadsheets/d/1x-ARIMlsHvdlwyxyGKd1YS-UF2K29MsXziutThBT1EI/edit?usp=sharing

  • last update using the mentioned above function: 14-Jan-2024 (Wrong Date)
  • The Last update should be 12-Jan-2024 (Right Date)

Hope anybody help me and many thanks in advance.

    • ajl_ahmed's avatar
      ajl_ahmed
      Iron Contributor

      Many thanks 

      If there is no valid condition then the function return this date 12/30/1899, How to avoid it? I demonstrate that in the google sheet. see the link please 

      • Harun24HR's avatar
        Harun24HR
        Bronze Contributor

        When there is no valid condition, the formula is returning false, means 0 (zero). In case of date type cells, 0 means 12/30/1899. To avoid this situation use custom cell formatting M/d/yyyy;;

         

         

  • =ARRAYFORMULA(LET(m, MAX(IF(C5:H5+C6:H6+C8:H8+(C9:H18<>""),C7:H7)), IF(m=0, "", m)))

Resources