Formula - Keep Getting a Ref Erro

SteveOranjin

Board Regular
Joined
Dec 18, 2017
Messages
170
Hello,

The below formula is designed to count the number of columns there are on a different sheet. There is a problem with it though, and that is if I delete a column/row then the ref errors out on me.

How do I reference a row/column so even if I delete a row/column within its range it will still work?

Code:
=IF(COUNTA('Data Sheet'!$1:$1)=0,"No Data In Sheet",(COUNTA('Data Sheet'!$1:$1)))
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Sounds like you are deleting row 1, and it doesn't like that, since your formula references that and there is no rows you can go less than 1.
Try this adaption, which should avoid that issues:
Code:
=IF(COUNTA(INDIRECT("'Data Sheet'!$1:$1"))=0,"No Data In Sheet",(COUNTA(INDIRECT("'Data Sheet'!$1:$1"))))
 
Upvote 0

Forum statistics

Threads
1,215,543
Messages
6,125,429
Members
449,223
Latest member
Narrian

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top