Results 1 to 3 of 3
  1. #1
    ecalvert is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    2

    IIF statement to compare data in two columns

    I have two columns of data...both numeric fields. I want to write an iif statement that returns the lesser of the two values in a third column...and on top of that, some of the fields might not have a value..in that case, the other column that has a number fills in the third...



    please help, any would be appreciated.

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Assuming none of your values are greater than 999999999, then this calculated field should work:
    Code:
    Lesser:IIF(NZ([Field1],999999999)<NZ([Field2],999999999),[Field1],[Field2])

  3. #3
    ecalvert is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    2
    thank you very much JoeM...worked like a charm.

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

Similar Threads

  1. Replies: 9
    Last Post: 01-03-2012, 11:35 AM
  2. case statement - multiple columns
    By eddiec in forum Queries
    Replies: 2
    Last Post: 07-05-2011, 03:24 AM
  3. Replies: 7
    Last Post: 12-03-2010, 11:09 AM
  4. Help with if statement to compare multiple fields
    By usmcgrunt in forum Programming
    Replies: 2
    Last Post: 12-01-2010, 06:43 PM
  5. Using IIF to compare two fields data
    By psych in forum Access
    Replies: 2
    Last Post: 03-10-2010, 10:11 AM

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