+ Reply to Thread
Results 1 to 6 of 6

Multiple conditions for if function

  1. #1
    Registered User
    Join Date
    04-12-2012
    Location
    lilongwe,malawi
    MS-Off Ver
    Excel 2007
    Posts
    4

    Multiple conditions for if function

    i have got data in an excel sheet in 3 columns, A,B,C

    What i want is B to be populated automaticaly.

    I want B to be populated if the following conditions are met,
    PART 1
    if A = 2012 and C = 1 then B = 1
    if A=2011 and C =1 then B =2
    if A =2010 and C= 1 then B=3
    PART 2
    if A = 2011 and C = 2 then B = 1
    if A=2010 and C =2 then B =2
    if A =2019 and C= 2 then B=3
    PART 3
    if A = 2010 and C = 3 then B = 1
    if A=2009 and C =3 then B =2
    if A =2008 and C= 3 then B=3
    PART 4
    if A = 2009 and C = 4 then B = 1
    if A=2008 and C =4 then B =2
    if A =2007 and C= 4 then B=3

    PART 5
    if A = 2008 and C = 5 then B = 1
    if A=2009 and C =5 then B =2
    if A =2006 and C= 5 then B=3

    Please help me, can all the parts be combined in one formula

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Multiple conditions for if function

    VBA will be most suited in your case.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Multiple conditions for if function

    Try:

    Please Login or Register  to view this content.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Multiple conditions for if function

    You can use This function in column B:
    Please Login or Register  to view this content.
    or you can use a Macro to populate column B

    Please Login or Register  to view this content.
    Regards,
    Khaled Elshaer
    www.BIMcentre.com

    Remember To Do the Following....
    1. Thank those who have helped you by clicking the Star below their post.
    2. Mark your post SOLVED if it has been answered satisfactorily:
    • Select Thread Tools (on top of your 1st post)
    • Select Mark this thread as Solved

  5. #5
    Registered User
    Join Date
    04-10-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: Multiple conditions for if function

    For a VBA solution try:
    Please Login or Register  to view this content.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Multiple conditions for if function

    Quote Originally Posted by Kelshaer View Post
    You can use This function in column B:
    Please Login or Register  to view this content.
    Good work...

    Can be simplified to:

    =IF(COUNT(A2,C2)=2,2013-A2-C2+1,"")

    and, if desired, then format cell as 0;-0;;@ to hide 0 result when matches not found

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1