Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Michael Dwyer
 
Posts: n/a
Default cell reference in formula

This is going to be very simple, I just know it, but I am stuck in a
mind-trap

A working formula which returns a count:
"=COUNTA(2:2)"
This would return something like "27", a count of cells in row 2 with
data, as does"
"=COUNTA($2:$2)"
"=COUNTA(MySheet!$2:MySheet!$2)"

Now I want to have a cell which I enter a "row number" for my formula
to count, i.e 2,3,4, etc

I would like to have something like
"=COUNTA((B5):(B5))"
"=COUNTA($(B5):$(B5))"
"=COUNTA(MySheet!$(B5):MySheet!$(B5))"

..... work, but it does not, and I can see why is does not. I just can't
figure out how to make it work.

Like I said this should be simple, I'm just stuck at the moment
  #2   Report Post  
Frank Kabel
 
Posts: n/a
Default

Hi
try
=COUNTA(INDIRECT(B5 & ":" & B5))

--
Regards
Frank Kabel
Frankfurt, Germany

Michael Dwyer wrote:
This is going to be very simple, I just know it, but I am stuck in a
mind-trap

A working formula which returns a count:
"=COUNTA(2:2)"
This would return something like "27", a count of cells in row 2 with
data, as does"
"=COUNTA($2:$2)"
"=COUNTA(MySheet!$2:MySheet!$2)"

Now I want to have a cell which I enter a "row number" for my formula
to count, i.e 2,3,4, etc

I would like to have something like
"=COUNTA((B5):(B5))"
"=COUNTA($(B5):$(B5))"
"=COUNTA(MySheet!$(B5):MySheet!$(B5))"

.... work, but it does not, and I can see why is does not. I just
can't figure out how to make it work.

Like I said this should be simple, I'm just stuck at the moment



  #3   Report Post  
Peo Sjoblom
 
Posts: n/a
Default

One way

=COUNTA(OFFSET(A1,B5-1,,,256))

You can also use INDIRECT

Regards,

Peo Sjoblom

"Michael Dwyer" wrote:

This is going to be very simple, I just know it, but I am stuck in a
mind-trap

A working formula which returns a count:
"=COUNTA(2:2)"
This would return something like "27", a count of cells in row 2 with
data, as does"
"=COUNTA($2:$2)"
"=COUNTA(MySheet!$2:MySheet!$2)"

Now I want to have a cell which I enter a "row number" for my formula
to count, i.e 2,3,4, etc

I would like to have something like
"=COUNTA((B5):(B5))"
"=COUNTA($(B5):$(B5))"
"=COUNTA(MySheet!$(B5):MySheet!$(B5))"

..... work, but it does not, and I can see why is does not. I just can't
figure out how to make it work.

Like I said this should be simple, I'm just stuck at the moment

  #4   Report Post  
Bernd Plumhoff
 
Posts: n/a
Default

If you enter your row number in cell B1, then

=COUNTA(INDEX(1:65536,B1,1):INDEX(1:65536,B1,256))

will give you the intended result. This solution avoids
the INDIRECT() and the OFFSET() functions which are
volatile (see
http://www.whooper.co.uk/excelstuff.htm#tip1
).

HTH,
Bernd
  #5   Report Post  
Harlan Grove
 
Posts: n/a
Default

Bernd Plumhoff wrote...
If you enter your row number in cell B1, then

=COUNTA(INDEX(1:65536,B1,1):INDEX(1:65536,B1,256) )

will give you the intended result. This solution avoids the INDIRECT()
and the OFFSET() functions which are volatile . . .

....

Good point, but why use two INDEX calls? Why not

=COUNTA(INDEX(1:65536,B1,0))

?




  #6   Report Post  
Bernd Plumhoff
 
Posts: n/a
Default

Hi Harlan,

Better point. Thanks.

Regards,
Bernd
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
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
Formula with text and reference to a date cell [email protected] Excel Discussion (Misc queries) 1 January 11th 05 08:15 AM
Using a formula in a Hyperlink Cell reference sslabbe Excel Discussion (Misc queries) 4 December 10th 04 12:30 AM
I there an easy way to find out if any formula reference a cell? Marc New Users to Excel 1 December 6th 04 10:41 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


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

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

About Us

"It's about Microsoft Excel"