+ Reply to Thread
Results 1 to 6 of 6

DSUM Beginner

  1. #1
    Registered User
    Join Date
    07-18-2011
    Location
    Ruidoso NM
    MS-Off Ver
    Excel 2010
    Posts
    62

    DSUM Beginner

    There are a zillion posts about DSUM, but I don't know how to find ones that answer my question without reading all zillion -- searching titles hasn't helped much.

    I'm fair to middling at Excel, including VBA, but have never used any database functions up to now. I tried to put in =DSUM(PersonsRange,"AgeGroup","Under 35") and got a #VALUE error. Put the rangename in quotes too, same. Tried = signs in various ways with the criterion, same. What am I doing wrong?

    Oh -- also tried using the column number in place of the "AgeGroup," same result.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: DSUM Beginner

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    07-18-2011
    Location
    Ruidoso NM
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: DSUM Beginner

    Big Duh for me, I need DCount, not DSum. Sorry, all. But I'll be back if I can't get that one to work either.

    LATER: Surprised to find DCount only works with numbers, and only tells you how many cells contain numbers, i.e., not how many contain 7 or 43 or whatever. Apparently there'sno built-in D-function to count occurrences of a specific value. Seems like an obvious thing. Anyhow, once I gave up on the D-functions, this took five minutes and does the job just fine:

    'Following will count items in any column of specified Range that match a specified value
    Public Function CountItems(varRange As Variant, varValue As Variant) As Integer
    Dim myRange As Range, myCel As Object
    Set myRange = varRange
    For Each myCel In myRange
    If myCel.Value = varValue Then CountItems = CountItems + 1
    Next myCel
    End Function
    Last edited by ikslohap; 01-05-2014 at 02:42 PM.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: DSUM Beginner

    Just like with regular function SUM and COUNT and COUNTA there are DSUM, DCOUNT to count numbers and DCOUNTA for text.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: DSUM Beginner

    =DCOUNT(A4:E10,"Age",C1:C2) where c6:c10 contain ages c5 is labeled "age" and c1 also contains the label "age"
    then any value put in c2 will be counted so put 20 and all values of 20 in c6:c10 will be counted
    exactly the same as countif(c6:c10,20)
    similarly for dcounta
    and i cannot see the value of
    'Following will count items in any column of specified Range that match a specified value
    Please Login or Register  to view this content.
    since excel already has that function built in eg
    =countif(a1:e120,"x") or countif(a2:a100,a2)
    Attached Files Attached Files
    Last edited by martindwilson; 01-05-2014 at 04:02 PM.

  6. #6
    Registered User
    Join Date
    07-18-2011
    Location
    Ruidoso NM
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: DSUM Beginner

    I don't follow that first part at all, frankly,but countif() is exactly what I needed. Was sure Excel must have something like that, but was only looking in the Database functions.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hello from a beginner
    By bstinson in forum Hello..Introduce yourself
    Replies: 5
    Last Post: 08-11-2013, 09:57 PM
  2. Beginner!
    By coffeemints in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 02-28-2013, 07:22 PM
  3. Beginner
    By cawwat85 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 02-28-2013, 01:34 PM
  4. Beginner
    By ruhat145 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 12-01-2012, 10:05 PM
  5. Help please for a beginner
    By LACKLUSTABUSTA in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-20-2010, 06:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1