#REF error when processing COUNTIFs formula

cochrajl

New Member
Joined
Sep 19, 2014
Messages
27
I have this spreadsheet which combines the contents of six different spreadsheets in a specified location. The way it runs is that I have an Auto_Open routine on Sheet 1 to combine them once I open this spreadsheet.

Where I'm having trouble at is that in Sheet 2 of this spreadsheet, I have a table to set up to run a COUNTIFS formula based on two different sets of criteria. The formula works great when the spreadsheet is open. But once I close the spreadsheet and reopen it, it sets the values to "#REF" because the contents of the spreadsheet are deleted and rebuilt when I open it again. Is there anyway to get around this?

I'll provide more information if needed.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
38,772
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Don't delete the cells, just clear them.
 

cochrajl

New Member
Joined
Sep 19, 2014
Messages
27
I did try this, but by not deleting the rows, its adding more rows below the contents each time the macro is run.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
38,772
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
It's pretty hard for me to comment about a macro I can't see. ;)
 

cochrajl

New Member
Joined
Sep 19, 2014
Messages
27
I may just add a routine that deletes the cells that do not contain data after all the other routines have ran and all the spreadsheets have been combined.
What code would enable me to do that?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
38,772
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Perhaps you could post what you have and we could see about fixing it?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,598
Messages
5,832,645
Members
430,150
Latest member
amitk1

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
Top