# Offset + Indirect / Index + Match



## drag1c (Nov 28, 2022)

Dear Mr.Excel,

I am struggling with OFFSET function when source row is deleted.
Here below is basic example:
1) Sheet*2*.Range("*A2:R50*") is my table with data
2) Sheet*1*.Range("*A5:R20*") is my table with offset data + scrollbar.

If I remove any row in table *1), *I automatically get #REF in Offset formula.
I've heard it could be possible to use Offset + Indirect in combination to avoid that problem so Offset can be referenced on cell address instead of data in cell.

Right now I use formula:

```
=IF(OFFSET(Database_Copy!A1,$A$6,0)="","",OFFSET(Database_Copy!A1,$A$6,0))
```

But I would like to switch it to OFFSET + Indirect (or Index(Match*)

Could you help me make such a formula?


----------



## jasonb75 (Nov 28, 2022)

What is in the source, is it numeric data or text?

It could be as simple as 
	
	
	
	
	
	



```
=T(INDEX(Database_Copy!A:A,ROWS(A$1:A1)+$A$6))
```

Note that the ROWS() part of the formula should refer to the cell that you enter the formula into (the first one before filling down) so if you enter it into F6 then you would change that part to F$6:F6 (this is done to prevent further errors if you delete rows on the formula sheet).


----------



## drag1c (Nov 29, 2022)

@jasonb75 table is with text, number and dates. When I have numbers or dates, this formula does not work. I've tried to remove "T function" but then it's chaotic.

So, it's a mix.

edit: It seems I've found solution like this:

```
=IF(IF(T(INDEX(Database_Copy!A:A,ROWS(B$6:B6)+$A$6))="",N(INDEX(Database_Copy!A:A,ROWS(B$6:B6)+$A$6)),T(INDEX(Database_Copy!A:A,ROWS(B$6:B6)+$A$6)))=0,"",IF(T(INDEX(Database_Copy!A:A,ROWS(B$6:B6)+$A$6))="",N(INDEX(Database_Copy!A:A,ROWS(B$6:B6)+$A$6)),T(INDEX(Database_Copy!A:A,ROWS(B$6:B6)+$A$6))))
```

This formula removes zeroes + it allows entering numbers and text in the same time.

Thank you very much @jasonb75 !


----------



## drag1c (Dec 20, 2022)

@jasonb75 to not open new topic, since it's addition:
If I would like to use your formula to show only filtered rows, how should I edit it?


----------

