Results 1 to 3 of 3
  1. #1
    Janae is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    2

    Combining two columns into one in access

    Hi,

    I am trying to combine my two columns of data into one column in access. I have one column that has all rows populated (col1) , and I have a second column that only is occasionally filled (col2), and is generally blank. Both columns contain different information. I want one column where if col2 is populated, it takes that value, but if col2 is blank, it shows the value from col1. How can I do this in access. In excel I would write a formula like so "if(col1="",col2,col1). I tried creating a query in access to do this using the iif function. Expression looked as follows:

    Expr1: IIf([Workday Sales Jul'12]![Bonus_Plan]="",[Workday Sales Jul'12]![Commission_Plan],[Workday Sales Jul'12]![Bonus_Plan])

    I have no idea if I created that expression correctly or not, but it didn't work, needless to say.



    Thanks.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    iif(col2> " ",col2,col1)
    which translates to if col2 is greater than space, then use col2 else use col1

  3. #3
    Janae is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    2
    Worked like a charm, thank you!!

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

Similar Threads

  1. Replies: 5
    Last Post: 03-29-2012, 09:21 PM
  2. combining 3 columns into 1 new column!
    By joebox8 in forum Queries
    Replies: 7
    Last Post: 07-06-2011, 01:46 AM
  3. Combining values of 2 columns into one string
    By LAazsx in forum Programming
    Replies: 1
    Last Post: 11-25-2010, 08:36 PM
  4. Combining columns into rows
    By steeveepee33 in forum Queries
    Replies: 5
    Last Post: 04-30-2009, 09:18 PM
  5. Replies: 1
    Last Post: 06-21-2007, 01:02 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