Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
JLBennett
 
Posts: n/a
Default Specify DCOUNTA Criteria in the Formula

I have a macro that uses the DCOUNTA formula repeatedly with a routine that
copies the results into a summary spreadsheet (not a very elegant solution.)
I am trying build a replacement that does not require me to visually show the
copying.

Here is my question: Is there a way to define the Criteria Array in the
formula itself instead of in a range on a spreadsheet? Something like...

=DCOUNTA('database'!A:H,1,{"Country","China","Stat us","Complete"})

The problem is that I do not know how to specify the two dimensions of this
array. I tried specifying the individual cells of a 2x2 array in a macro,
but I get a "data type mismatch" error.

Dim criteria(1, 1) As String
criteria(0, 0) = """Country"""
criteria(0, 1) = """Mid-year Status"""
criteria(1, 0) = """China"""
criteria(1, 1) = """Complete"""
ActiveCell.Value = WS.Evaluate("=DCOUNTA('database'!A:H,1," & criteria &
")")

Ideas?

Thank you.
  #2   Report Post  
Stefi
 
Posts: n/a
Default

Why don't you use simply
Application.ScreenUpdating = False
at the start of your code if you only want eliminate displaying changes?
At the end of the code apply
Application.ScreenUpdating = True

Regards,
Stefi

JLBennett ezt *rta:

I have a macro that uses the DCOUNTA formula repeatedly with a routine that
copies the results into a summary spreadsheet (not a very elegant solution.)
I am trying build a replacement that does not require me to visually show the
copying.

Here is my question: Is there a way to define the Criteria Array in the
formula itself instead of in a range on a spreadsheet? Something like...

=DCOUNTA('database'!A:H,1,{"Country","China","Stat us","Complete"})

The problem is that I do not know how to specify the two dimensions of this
array. I tried specifying the individual cells of a 2x2 array in a macro,
but I get a "data type mismatch" error.

Dim criteria(1, 1) As String
criteria(0, 0) = """Country"""
criteria(0, 1) = """Mid-year Status"""
criteria(1, 0) = """China"""
criteria(1, 1) = """Complete"""
ActiveCell.Value = WS.Evaluate("=DCOUNTA('database'!A:H,1," & criteria &
")")

Ideas?

Thank you.

  #3   Report Post  
JLBennett
 
Posts: n/a
Default

Thanks for your help, Stefi!

Silly me. It had been awhile since I had built a macro where this mattered.
I forgot about this option and dived in for a frontal assault.

Regards,
-Jeff

"Stefi" wrote:

Why don't you use simply
Application.ScreenUpdating = False
at the start of your code if you only want eliminate displaying changes?
At the end of the code apply
Application.ScreenUpdating = True

Regards,
Stefi

JLBennett ezt *rta:

I have a macro that uses the DCOUNTA formula repeatedly with a routine that
copies the results into a summary spreadsheet (not a very elegant solution.)
I am trying build a replacement that does not require me to visually show the
copying.

Here is my question: Is there a way to define the Criteria Array in the
formula itself instead of in a range on a spreadsheet? Something like...

=DCOUNTA('database'!A:H,1,{"Country","China","Stat us","Complete"})

The problem is that I do not know how to specify the two dimensions of this
array. I tried specifying the individual cells of a 2x2 array in a macro,
but I get a "data type mismatch" error.

Dim criteria(1, 1) As String
criteria(0, 0) = """Country"""
criteria(0, 1) = """Mid-year Status"""
criteria(1, 0) = """China"""
criteria(1, 1) = """Complete"""
ActiveCell.Value = WS.Evaluate("=DCOUNTA('database'!A:H,1," & criteria &
")")

Ideas?

Thank you.

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
popup message if certain criteria met in formula result John Davies Excel Worksheet Functions 0 June 28th 05 10:15 AM
Average Formula with Criteria PW11111 Excel Discussion (Misc queries) 1 June 10th 05 02:22 PM
IF & VLOOKUP FORMULA taxmom Excel Worksheet Functions 3 March 2nd 05 03:35 PM
Countif formula with multiple criteria ie >30 and <60? Dali Excel Worksheet Functions 2 January 7th 05 04:49 PM
Cell doesn't show formula result - it shows formula (CTRL + ' doe. o0o0o0o Excel Worksheet Functions 6 November 19th 04 03:13 PM


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