Count Minimum and Maximum values in a report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mshakeelattari
    New Member
    • Nov 2014
    • 101

    Count Minimum and Maximum values in a report

    I have a query in MS Access that gets data from other queries. It generates a field that contains numeric data and, if no number, a string: "Abs". When designing report based on this query, the Min() function gives the minimum number of the field whereas Max() function returns the string "Abs". But I want the Min and Max values from only the numbers. Any help will be appreciated.
    Thanks
  • jforbes
    Recognized Expert Top Contributor
    • Aug 2014
    • 1107

    #2
    It sounds like the column you are attempting to get the Max() out of isn't numeric. You'll want to set it to numeric, if you can, or if this query starts taking a long time to return results. So, if you want to leave the Table the way it is, you can try:
    Code:
    Max(Val([YourFieldName]))
    This will cause a conversion to a numeric value on the field. This will convert text to a zero and if the field is alphanumeric, it will grab the number, if it is before any text, and use it. ex:
    Code:
    "2" -> 2
    "2f2ff2f22f" -> 2
    "ff2ff2f2ff2" -> 0

    Comment

    • twinnyfo
      Recognized Expert Moderator Specialist
      • Nov 2011
      • 3663

      #3
      You could also add criteria to your query:

      Code:
      WHERE [FieldName] <> "Abs"

      Comment

      • mshakeelattari
        New Member
        • Nov 2014
        • 101

        #4
        jforbes and twinnyfo, Thak You

        Comment

        Working...