LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Counting rows based on multiple values

Sorry, that wasn't a VBA function. That was a worksheet Function. If you
want to use it in VBA, you would do

intClosedDRs = Application.Evaluate("SUMPRODUCT(--(E2:E" & _
intLastRow & ")={""AIE"",""AMS"",""AMB"",""TMS""}))")

checking the string in the immediate window:

intLastRow = 20
? ("SUMPRODUCT(--(E2:E" & _
intLastRow & ")={""AIE"",""AMS"",""AMB"",""TMS""}))")
SUMPRODUCT(--(E2:E20)={"AIE","AMS","AMB","TMS"}))

looks to produce a well formed formula

Note you had a space after AMB which I removed. If you want it, then put it
back.


--
Regards,
Tom Ogilvy



"Wiley" wrote:

Tom.

I tried that as shown in my code line here. I get a compile error of
"Expected Expression :)" with the ":" highlihghted after E2. intLastRw is
the last data record determined earlier in the code. Even if I use E2:E10, I
get the same error.

intClosedDRs =SUMPRODUCT(--(E2:("E" & intLastRow)={"AIE","AMS","AMB ","TMS"}))

Thanks.


"Tom Ogilvy" wrote:

You might be able to do all you want by using a pivot Table report on your
data.


another approach

=SUMPRODUCT(--(A1:A10={1,3,5}))

counts rows that contain a 1, 3 or 5 in A1:A10.

--
Regards,
Tom Ogilvy



"Wiley" wrote:

I have a spreadsheet which I need to return record counts based upon the row
containing any of 10 values in Column E. To make it worse, for a different
count, I will need to consder a subset of values in Column E as well. I
will need to do multiple variations of this tp establish a variety of metrics.

Yes, DB would be better, but not available to me.

I am just above the novice level. What VBA functions should I consider? Is
this a good use for an array? If so, some tips would be helpful. Or is
there a better (easier) approach?

Thanks for your help.

 
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
Counting rows based on the contents of multiple cells Bret[_2_] Excel Worksheet Functions 2 August 11th 09 09:26 PM
Counting values based on multiple conditions Paul Excel Worksheet Functions 4 December 18th 08 08:01 PM
Counting rows based on multiple columns Doyle Excel Worksheet Functions 1 September 29th 06 07:06 PM
counting rows with same values for multiple values Jon Viehe New Users to Excel 4 September 1st 05 03:49 PM
Counting rows based on criteria in multiple cells Margaret Excel Discussion (Misc queries) 11 December 2nd 04 11:04 PM


All times are GMT +1. The time now is 08:46 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"