Forum Discussion

DavidHeath's avatar
DavidHeath
Copper Contributor
Dec 26, 2021

relative cell references in a formula

I have a worksheet that performs a lookup to another sheet to count how many items of the type are there.

 

Anyone familiar with disc golf will recognise what I have in the image below. The only formula is for stock, everything else is static data. For instance cell G2 contains: =COUNTIF(Master!B:B,'Flight Numbers'!B2)   The sheet we're looking at is 'Flight Numbers' and 'Master' contains one line for each item currently in stock.

 

I regularly want to re-order the page using the filter buttons, but when I do, the stock values get mucked up as they stick with the row number they had prior to any re-order.

 

What I'm seeking is a way to structure the formula so that it has some kind of reference to "current column minus 5" - is that possible?

 

 

Thanks...

 

6 Replies

  • Do you have the data in an Excel Table? That only allows entire records to be sorted and a unit and tends to be more meaningful.
    • DavidHeath's avatar
      DavidHeath
      Copper Contributor
      I'll take a look. I've heard of tables, but never used them.

      Thanks.
      • PeterBartholomew1's avatar
        PeterBartholomew1
        Silver Contributor
        Ctrl/L or Ctrl/T are shortcuts to creating a table when a cell within the would be Table is selected. Make sure there is blank space around the table.

Resources