Obtaining blanks

azizrasul

Well-known Member
Joined
Jul 7, 2003
Messages
1,304
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Using

=OFFSET(tblReports!$G$2,0,0,COUNTA(tblReports!G:G))

I create a dynamic range of data called "Reports" in sheet "tblReports". However when I select a cell on another sheet called "Main", and do a Data Validation on a cell and select List and make the Source =Reports, I still get blanks appearring in the drop down! What can I be doing wrong?
 
You need to subtract 1 from the counta because you have a header in G1

If you look at the new attached image file, depending on the name chosen, the number or=f rows differes. By including -1 as suggested, it works for my name but when I choose a different name, the number of rows may be less so I end up with blanks. I don't understand why COUNTA does not calculate correctly depending on the name chosen and the subsequent rows that it produces.
 

Attachments

  • Untitled2.png
    Untitled2.png
    97 KB · Views: 4
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi Azizrusal,

I believe the answers you were given of subtracting one from your COUNTA would work but let me try another approach. You're already explicit about starting at $G$2 so why not pick a range starting at $G$2 for the COUNTA and ending at a row you'll never exceed. Maybe:
Excel Formula:
=OFFSET(tblReports!$G$2,0,0,COUNTA(tblReports!$G$2:$G$999))

1627332751536.png
 
Upvote 0
That is what I posted previously -subtract 1.
Subtracting 1 or using

Code:
=OFFSET(tblReports!$G$2,0,0,COUNTA(tblReports!$G$2:$G$999))

makes no difference. When I choose Jake Tempest, I still get extra blank rows as Jake has less rows than me i.e. Aziz. It doesn't behave in a dynamic way!£%^&?
 
Upvote 0
You showed us the Named Range screen when Aziz was selected. Please show us that screen again when Jake Tempest is selected.
 
Upvote 0

Attachments

  • Untitled3.png
    Untitled3.png
    155.2 KB · Views: 3
  • Untitled4.png
    Untitled4.png
    158.7 KB · Views: 3
Upvote 0
There must be a character of some kind, probably a space, in the Report Name (or if those are derived entries then their source), so either make them null or try
Excel Formula:
=OFFSET(tblReports!$G$2,0,0,COUNTIF(tblReports!$G$2:$G$999,"> "))
 
Upvote 0
If you have a formula in col G then the cells are not empty & so Counta will count them.
 
Upvote 0
If you have a formula in col G then the cells are not empty & so Counta will count them.
Ah, I didn't realise that "" would constitute data. Used the formula given post #17 and that works. Thanks all for staying with this, much appreciated.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,559
Members
449,089
Latest member
Motoracer88

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