Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Dynamic Range Name Anomalities

Created A Dynamic range with this formula
=offset(sheet1!$a$1,0,0,countif(sheet1!$a:$a,"<x" ),1) call it
MyRange

Col A:
1 AAA
2 BBB
3 CCC
4 x
5 x

IF I go to VBA and use Immediate Windows and I type:
? Range("MyRange").Rows.Count ................... I get
65531 ( I am using Excel 2007 )
My logic tells me it should be 3

Now if I go to A6 and type =CountIF(a1:a5,"<x")
I get 3

Can someone enlighten me ????
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Dynamic Range Name Anomalities

Hi Arishy,

I am assuming that with the result you are getting that you have the
workbook saved in 97-2003 format. Also I would expect the result to be 65534
not 65531.

Reason is that your countif counts all cells < "x" in column A and it will
include all of the blank cells because none of the blank cells are equal to
"x".


--
Regards,

OssieMac


"Arishy" wrote:

Created A Dynamic range with this formula
=offset(sheet1!$a$1,0,0,countif(sheet1!$a:$a,"<x" ),1) call it
MyRange

Col A:
1 AAA
2 BBB
3 CCC
4 x
5 x

IF I go to VBA and use Immediate Windows and I type:
? Range("MyRange").Rows.Count ................... I get
65531 ( I am using Excel 2007 )
My logic tells me it should be 3

Now if I go to A6 and type =CountIF(a1:a5,"<x")
I get 3

Can someone enlighten me ????
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Dynamic Range Name Anomalities

Presumably Cells a6:a65536 are empty and therefore are not = x and so get
counted.

Try something like
=offset(sheet1!$a$1,0,0,countif(sheet1!$a:$a,"<x" )-countif(sheet1!$a:$a,"="),1)

Charles
___________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"Arishy" wrote in message
...
Created A Dynamic range with this formula
=offset(sheet1!$a$1,0,0,countif(sheet1!$a:$a,"<x" ),1) call it
MyRange

Col A:
1 AAA
2 BBB
3 CCC
4 x
5 x

IF I go to VBA and use Immediate Windows and I type:
? Range("MyRange").Rows.Count ................... I get
65531 ( I am using Excel 2007 )
My logic tells me it should be 3

Now if I go to A6 and type =CountIF(a1:a5,"<x")
I get 3

Can someone enlighten me ????



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Dynamic Range Name Anomalities

Afterthought. Try using
=OFFSET(Sheet1!$A$1,0,0,COUNTA($A:$A)-COUNTIF($A:$A,"=x"))

That should return the result you want.

--
Regards,

OssieMac


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Dynamic Range Name Anomalities

On Dec 31 2009, 11:35*am, OssieMac
wrote:
Afterthought. Try using
=OFFSET(Sheet1!$A$1,0,0,COUNTA($A:$A)-COUNTIF($A:$A,"=x"))

That should return the result you want.

--
Regards,

OssieMac


You are right, the WB was created for Excel 2003 hence the lower
number.
Blanks are not equal -x I missed that ...Thank you for pointing me to
the right direction.
As for your last Iteration....Worked like a charm....Have a lovely New
year.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic range based on criteria, within a dynamic range, passed to a function [email protected] Excel Programming 5 October 9th 07 10:13 PM
creating a dynamic range based on criteria, within a dynamic range, and passing it to a function [email protected] Excel Programming 0 October 9th 07 05:22 PM
getting the absolute range address from a dynamic named range junoon Excel Programming 2 March 21st 06 01:29 PM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
select dynamic range with dynamic start point Juli Excel Programming 1 August 31st 05 12:05 AM


All times are GMT +1. The time now is 06:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"