A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Dynamic Range



 
 
Thread Tools Display Modes
  #1  
Old November 11th, 2003, 05:40 PM
Brian
external usenet poster
 
Posts: n/a
Default Dynamic Range

I am trying to create a macro and am stuck trying to
figure out how to determine my last column. In cell E3 I
am using the formula =COUNTIF(E4:??,0). Can I create a
dynamic range going across columns? In other words, on
some sheets, it may be =COUNTIF(E4:S4,0) and other times
it may be =COUNTIF(E4:AA4,0). tia
  #2  
Old November 11th, 2003, 05:54 PM
Peo Sjoblom
external usenet poster
 
Posts: n/a
Default Dynamic Range

You can use something like

=COUNTIF(OFFSET($E$4,,,1,COUNTA($E$4:$IV$4)),0)

or if you are using it on sheet3 , do insertnamedefine and call the offset
part "MyRange" (w/o quotes)
and in the refers to box put

=OFFSET(Sheet3!$E$4,,,1,COUNTA(Sheet3!$E$4:$IV$4))

then use it like

=COUNTIF(MyRange,0)

--

Regards,

Peo Sjoblom


"Brian" wrote in message
...
I am trying to create a macro and am stuck trying to
figure out how to determine my last column. In cell E3 I
am using the formula =COUNTIF(E4:??,0). Can I create a
dynamic range going across columns? In other words, on
some sheets, it may be =COUNTIF(E4:S4,0) and other times
it may be =COUNTIF(E4:AA4,0). tia



  #3  
Old November 11th, 2003, 06:02 PM
Peo Sjoblom
external usenet poster
 
Posts: n/a
Default Dynamic Range

I might add that you might want to check the range since if it is empty it
will return an error

=IF(COUNTBLANK(E4:IV4)=252,"",COUNTIF(MyRange,0))

--

Regards,

Peo Sjoblom


"Peo Sjoblom" wrote in message
...
You can use something like

=COUNTIF(OFFSET($E$4,,,1,COUNTA($E$4:$IV$4)),0)

or if you are using it on sheet3 , do insertnamedefine and call the

offset
part "MyRange" (w/o quotes)
and in the refers to box put

=OFFSET(Sheet3!$E$4,,,1,COUNTA(Sheet3!$E$4:$IV$4))

then use it like

=COUNTIF(MyRange,0)

--

Regards,

Peo Sjoblom


"Brian" wrote in message
...
I am trying to create a macro and am stuck trying to
figure out how to determine my last column. In cell E3 I
am using the formula =COUNTIF(E4:??,0). Can I create a
dynamic range going across columns? In other words, on
some sheets, it may be =COUNTIF(E4:S4,0) and other times
it may be =COUNTIF(E4:AA4,0). tia





  #4  
Old November 11th, 2003, 06:11 PM
Brian
external usenet poster
 
Posts: n/a
Default Dynamic Range

Works great, thanks. can you tell me why I get a screen
that says 'Update Values'?? Is there something I can do
so this does not show up?



-----Original Message-----
You can use something like

=COUNTIF(OFFSET($E$4,,,1,COUNTA($E$4:$IV$4)),0)

or if you are using it on sheet3 , do insertnamedefine

and call the offset
part "MyRange" (w/o quotes)
and in the refers to box put

=OFFSET(Sheet3!$E$4,,,1,COUNTA(Sheet3!$E$4:$IV$4) )

then use it like

=COUNTIF(MyRange,0)

--

Regards,

Peo Sjoblom


"Brian" wrote in

message
...
I am trying to create a macro and am stuck trying to
figure out how to determine my last column. In cell E3

I
am using the formula =COUNTIF(E4:??,0). Can I create a
dynamic range going across columns? In other words, on
some sheets, it may be =COUNTIF(E4:S4,0) and other times
it may be =COUNTIF(E4:AA4,0). tia



.

  #5  
Old November 11th, 2003, 06:22 PM
Peo Sjoblom
external usenet poster
 
Posts: n/a
Default Dynamic Range

That is the drawback with offset, it is volatile so even if you don't do any
change it will always
ask if you want to save the workbook when you close it.. It might be worth
that though..

--

Regards,

Peo Sjoblom


"Brian" wrote in message
...
Works great, thanks. can you tell me why I get a screen
that says 'Update Values'?? Is there something I can do
so this does not show up?



-----Original Message-----
You can use something like

=COUNTIF(OFFSET($E$4,,,1,COUNTA($E$4:$IV$4)),0)

or if you are using it on sheet3 , do insertnamedefine

and call the offset
part "MyRange" (w/o quotes)
and in the refers to box put

=OFFSET(Sheet3!$E$4,,,1,COUNTA(Sheet3!$E$4:$IV$4) )

then use it like

=COUNTIF(MyRange,0)

--

Regards,

Peo Sjoblom


"Brian" wrote in

message
...
I am trying to create a macro and am stuck trying to
figure out how to determine my last column. In cell E3

I
am using the formula =COUNTIF(E4:??,0). Can I create a
dynamic range going across columns? In other words, on
some sheets, it may be =COUNTIF(E4:S4,0) and other times
it may be =COUNTIF(E4:AA4,0). tia



.



  #6  
Old November 11th, 2003, 08:53 PM
Aladin Akyurek
external usenet poster
 
Posts: n/a
Default Dynamic Range

Also...

If the ranges the CountIf formula is applied to houses numeric data (number,
date, or time), try...

=COUNTIF(E4:INDEX(4:4,MATCH(BigNum,4:4)),0)

where BigNum is a defined name referring to 9.99999999999999E+307.

"Brian" wrote in message
...
I am trying to create a macro and am stuck trying to
figure out how to determine my last column. In cell E3 I
am using the formula =COUNTIF(E4:??,0). Can I create a
dynamic range going across columns? In other words, on
some sheets, it may be =COUNTIF(E4:S4,0) and other times
it may be =COUNTIF(E4:AA4,0). tia



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:11 AM.


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