Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
DoctorG
 
Posts: n/a
Default Single statement database/range processing with criteria

Although Excel provides Database processing (DSUM etc) it does so with
"external" criteria - "external" meaning that they are defined in cells
outside the Database function.

I have seen posts that process ranges with really complex criteria defined
in a single statement. Having all search conditions within the cell statement
is preferable as far as I am concerned as it results in less messy
spreadsheets. Can anyone provide links to articles describing ways to process
ranges/databases with criteria such as the following in a single statement?

Capitalized words represent Fieldnames (column headings).

- find in PRICES_DATABASE the PRICE where ITEM = Search_Item and Search_Date
is = to PRICE_VALID_FROM and <= to PRICE_VALID_TO

- sum all AMOUNT in TRANSACTIONS_DATABASE where YEAR = 2006 and TRNS_TYPE =
"Sales"

Thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tom Ogilvy
 
Posts: n/a
Default Single statement database/range processing with criteria

If you want to extract the records or hide non conforming records, then it
would be unlikely that a worksheet function would be the usual approach. If
you want to sum the prices

=Sumproduct(--(Item=Search_Item),--(Price_Valid_From<=Search_Date),--(Price_
Valid_To=Search_Date),Prices))

=Sumproduct(--(Year(DateColumn)=2006),--(Trans_Type="Sales"),Amount)


These could be defined names (insert=Name=Define) or replaced by actual
ranges.

--
Regards,
Tom Ogilvy



"DoctorG" wrote in message
...
Although Excel provides Database processing (DSUM etc) it does so with
"external" criteria - "external" meaning that they are defined in cells
outside the Database function.

I have seen posts that process ranges with really complex criteria defined
in a single statement. Having all search conditions within the cell

statement
is preferable as far as I am concerned as it results in less messy
spreadsheets. Can anyone provide links to articles describing ways to

process
ranges/databases with criteria such as the following in a single

statement?

Capitalized words represent Fieldnames (column headings).

- find in PRICES_DATABASE the PRICE where ITEM = Search_Item and

Search_Date
is = to PRICE_VALID_FROM and <= to PRICE_VALID_TO

- sum all AMOUNT in TRANSACTIONS_DATABASE where YEAR = 2006 and TRNS_TYPE

=
"Sales"

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
DoctorG
 
Posts: n/a
Default Single statement database/range processing with criteria

Tom I don't want to extract or hide lines. I only need to sum values in a
database and locate a value (as is the price of an item on a given date).
Anyway, the summing method would be applicable to locate a value provided
there is only one matching record.

What I do not see in your answer, unfortunately, is a way to provide a
database range and the appropriate column headings (fieldnames ??) instead of
having to set up named ranges for every column I wish to use as a criterion.
I guess it's because we are using a range function instead of a database
function and only databases use the first row as field names. Any comment on
this is welcome.

I guess I'll stick to the SUMPRODUCT function. One last thing though...
When/why do we use the "--" outside the parentheses? What does it stand for?
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
IF statement using multiple criteria Joe Gieder Excel Worksheet Functions 1 October 27th 05 09:11 PM
How do I use a "check(ed) box" as a criteria in an "=if" statement Bill Bromback Excel Worksheet Functions 1 August 19th 05 05:28 PM
Searching for a criteria in array of cells within an IF statement selvaraj Excel Worksheet Functions 1 July 28th 05 03:36 PM
Do I need a sumif or sum of a vlookup formula? PeterB Excel Worksheet Functions 0 June 1st 05 12:23 PM
If Statement Criteria Brent E Excel Worksheet Functions 2 May 12th 05 12:13 AM


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

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"