Results 1 to 6 of 6
  1. #1
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245

    calcs with null values

    Hey

    I have a table of returns. It is set up like this:

    ProductID..MonthlyDate...Returns...

    Now i have a query running to only show the negative returns. It leaves the positive returns Null



    IIF(Return<0, Return, "")


    Now I then run a query to get basic statistics. Standard Deviation. Variance, and average.

    But It will not run. I know it is because there are null values.. I have tried making them zero, or using the NZ() function, but this affects the statitics I want to calculate.

    Any ideas how to work around this? Thanks,

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Quote Originally Posted by mike02 View Post
    It leaves the positive returns Null

    IIF(Return<0, Return, "")
    For clarity's sake, you haven't made them Null, you've made them zero length string's:

    http://www.baldyweb.com/NullEmptyEtc.htm

    Would it be an option to eliminate positive values from the query via criteria, rather than leaving them in and manipulating the value?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Kyle02 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    16
    out of curiosity, Paul, how do you do this:

    If i were to take mike02's information and make a cross tab query, so I cant use the criteria but instead use the IIF, so values would have a zero length string instead of a negative return.

    If you were calculating covariance for example, you would need the Sum of XY, for X is one Product and Y is another Product. to get the sum, would result in an error. also, the N value would be different for each product,

    Sxy= (1/(n-1))*(EXY-(n*Xbar*Ybar))

    im looking at calculating that with this same idea mike02 has posted,

    (i am knew, so if i should start a new thread please let me know)

    Cheers,

  4. #4
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245
    Thanks Pbaldy, worked for the basic statistics!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Does using 0 instead of "" work? That should let the sums work.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Happy to help Michael!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Finding the Max Date and Null Values if Null
    By SpdRacerX in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 06:29 AM
  2. Count() and Null Values
    By jpvonhemel in forum Queries
    Replies: 4
    Last Post: 10-21-2011, 03:37 AM
  3. Query with null values
    By Psyclone in forum Queries
    Replies: 3
    Last Post: 03-30-2011, 09:57 PM
  4. null values
    By ippy in forum Queries
    Replies: 3
    Last Post: 12-20-2010, 10:39 AM
  5. HELP with NULL DateTime VALUES
    By lfolger in forum Programming
    Replies: 3
    Last Post: 03-28-2008, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums