Forum Discussion

OshBerr's avatar
OshBerr
Copper Contributor
Jun 17, 2023
Solved

Trying to use an index-counta formula, but the range has IF function data

I am trying to gather the most recent value inputted within a column.  The base formula I am using is =INDEX(C6:C301, COUNTA(C6:C301))

 

However, it pulls back no data (no error, it just leaves the cell blank). I assume this is because in the range I have selected, there are =IF functions within them (eg =IF([@Weight],((B300/($H$5*$H$5))*703),"")).

 

I am unsure if there is a formula to only include the cells with values (which will be updated as the sheet gets updated), or if there is a way to include the currently "empty" cells until they are filled in. 

  • OshBerr Since your IF formula returns either a number or "", try this:

    =INDEX(C6:C301,MATCH(99^99,C6:C301))

    It should always return the last number entered in the range, thus ignoring cells with "".

     

    In case you are using Excel365 you could try this:

    =TAKE(FILTER(C6:C301,C6:C301<>""),-1)

     

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    OshBerr Since your IF formula returns either a number or "", try this:

    =INDEX(C6:C301,MATCH(99^99,C6:C301))

    It should always return the last number entered in the range, thus ignoring cells with "".

     

    In case you are using Excel365 you could try this:

    =TAKE(FILTER(C6:C301,C6:C301<>""),-1)

     

    • OshBerr's avatar
      OshBerr
      Copper Contributor
      Thank you very much, this worked!

Resources