The information in this article applies to:
SYMPTOMSIn Microsoft Excel version 5.0 for the Macintosh and Microsoft Excel version 5.0 for Windows NT, the DSUM() and DAVERAGE() functions may return incorrect results if you are using computed criteria for your database. CAUSE
When you use computed criteria, the DSUM() and DAVERAGE() functions return
only the first record in the database that matches the criteria.
WORKAROUNDTo avoid this problem, you can use the following Visual Basic procedure. When you run the procedure, you are prompted to enter the name of the field in the database for which you would like to compute the DSUM(). For example, if your DSUM() formula would appear as follows
then enter Bravo in the dialog box that
prompts you to enter a field name. Once you enter the field name, the
procedure computes the correct DSUM value and enters that value in the
active cell in the worksheet.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.asp
To use this procedure, do the following:
To compute the DAVERAGE() function, use the NewDSUM subroutine to compute the DSUM value. Then, enter the following formula =<DSUMCell>/DCOUNT(Database,<FieldName>,Criteria)where <DSUMCell> is the cell that contains the DSUM value and <FieldName> is the field name in the database. STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel for the Macintosh, version 5.0a. Additional query words: 5.00a 5.00c
Keywords : kbcode xlformula |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |