Results 1 to 3 of 3

Thread: Access Query: Calculate lowest value field

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Location
    Leeds
    Posts
    72

    Access Query: Calculate lowest value field

    Hi.

    I have a query with 3 fields that will contain a numerical value. I want to add another calculated field that looks at the 3 fields and returns the value of the field with the lowest number.

    So:

    Field1: 25
    Field2: 16
    Filed3: 21

    CalculatedField: 16

    Anyone know the formula I would put into the calculated field.

    Thanks a lot

    James Brown

  2. #2
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    Code:
    SELECT Field1, Field2, Field3, 
    IIf([Field1]<[Field2] And [Field1]<[Field3],[Field1],IIf([Field2]<[Field1] And [Field2]<[Field3],[Field2],[Field3])) AS MinValue 
    FROM TableName

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Location
    Leeds
    Posts
    72
    Thanks andreys, worked a treat.

    Thanks for your help.

    James

Posting Permissions

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



Click Here to Expand Forum to Full Width