How to reference the <CELL ABOVE>

Options
BP97
BP97 ✭✭
edited 12/09/19 in Formulas and Functions

Is there a way to reference the cell above?

example:

=IF(logical_expression, value_if_true, <CELL ABOVE>)

The simple way is to reference using [COLUMN_NAME]2 (the number being the current row number minus one). But this is broken anytime a row is deleted, which happens frequently on our sheet.

I have tried adding an "index" and "RowNum" column with the formulas; "=1+0", and "=SUM(index$1:index@row)" respectively, then I tried referencing the <CELL ABOVE> with INDEX([COLUMN_NAME]:[COLUMN_NAME], RowNum@row-1) but this returned the "#CIRCULAR REFERENCE" error.

There is a number of ways this can be accomplished in Excel including the OFFSET() and ROW() functions.

Comments

  • L_123
    L_123 ✭✭✭✭✭✭
    Options

    Something like this?

     

    =INDEX(a:a, COUNTIF(a1:a3, ISBLANK(@cell)) + COUNT(a1:a3))

     

    (In Cell A4)

  • BP97
    BP97 ✭✭
    Options

    Thanks for your response Luke,

    I couldnt seem to get your formula to work.

    The application of the formulas is to copy information from parent rows to their children rows. (Eg. Project status is included in the parent row, but this information needs to be included in each of the children rows for filtering and reports.)

    Thanks

  • L_123
    L_123 ✭✭✭✭✭✭
    Options

    if they are divided into parent child rows just call the parent

     

    =PARENT([Column5]2)

     

    Where [column5]2 is the cell that the formula is in

  • Chris McKay
    Chris McKay ✭✭✭✭✭✭
    Options

    It's not elegant and is kinda cheating, but this works. Assuming we're working on Row 10:

    =IF([Column 1]10 = "Hi", INDEX([Column 2]$1:[Column 2]9, COUNTIF([Column 2]$1:[Column 2]9, NOT(ISBLANK(@cell))) + COUNTIF([Column 2]$1:[Column 2]9, ISBLANK(@cell))), "")

    It should eliminate the issue of deleted rows causing a #REF.

  • BP97
    BP97 ✭✭
    Options

    Thanks again Luke,

    Not sure how I overlooked using that!

    I used a combination of PARENT and INDEX(ANCESTORS(),[Parent Level]) formulas to reference parent and grandparent rows.

    Cheers!

  • BP97
    BP97 ✭✭
    Options

    Thanks for the response Chris,

    I managed to avoid referencing <CELL ABOVE> altogether, but i'll keep your formula in mind, i'm sure it will come in handy sometime!

    Cheers!

  • Chris McKay
    Chris McKay ✭✭✭✭✭✭
    Options

    Glad to hear you worked it out! I'd love to have some of the extended functions offered by Excel. OFFSET, ADDRESS would make things a lot easier.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!