=INDIRECT("Country_"&$B$2&"!"&am

Lexje

Active Member
Joined
Jul 6, 2004
Messages
264
Hi Folks,

I got this formula:
=INDIRECT("Country_"&$B$2&"!"&CELL("address";A5))

$B$2 = linked cell from a drop downlist, will contain years from 1999:2009
So, basically the formula will look into the sheet with the name:
Country_1999 to Country_2009
In order to get all the values in the relative sheets, I need to copy this formula all the way down a column.
This makes for 0 in all relative 'empty' cells.


How can we finetune this formula so that it will only look at non-empty cells in the referenced sheets?

I was thinking of doing something like:

While Not IsEmpty(ActiveCell)
'macro code that acts on the active cell
'change the active cell to the next cell
ActiveCell.Offset(1, 0).Select
Wend

But I'm not sure on how to do this to adapt to the relative sheets...
Any suggestions?

Thanks for your help!!

Erwin.

:whistle:
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Re: =INDIRECT("Country_"&$B$2&"!&quot

How about:

=IF(ISNUMBER(INDIRECT("sheet"&A1&"!"&CELL("address",A2))),INDIRECT("sheet"&A1&"!"&CELL("address",A2)),"")
 
Upvote 0
Re: =INDIRECT("Country_"&$B$2&"!&quot

Oaktree, thanks for hopping in!!

I tried your formula, but it wouldn't work. It doesn't give me an error, but just shows all blanks.

But, more important, is that my sole purpose was not particularly getting rid of the 0's.

The idea was to fill the sheet with numbers from the 10 other sheets, but to only fill IF there is content present in the source location.

This way, I also avoid wasting processor time in void calculations.

Thanks for your help!!

Erwin
 
Upvote 0

Forum statistics

Threads
1,214,818
Messages
6,121,725
Members
449,049
Latest member
MiguekHeka

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