+ Reply to Thread
Results 1 to 6 of 6

Combining an AND and IF function - how to?

  1. #1
    Registered User
    Join Date
    04-17-2012
    Location
    mauritius
    MS-Off Ver
    Excel 2007
    Posts
    37

    Combining an AND and IF function - how to?

    Hi,
    I am trying to combine an AND and IF functions to be able to insert the corresponding account number in cell C5.
    I am attaching the file for your reference. Can anyone help me do that please? Thank you,
    Newuser
    Attached Files Attached Files

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Combining an AND and IF function - how to?

    newtoexcel24,

    Welcome to the forum!
    Using your posted example workbook, you can use this formula in cell C5:

    =INDEX(G1:G13,MATCH(1,INDEX((E1:E13=C3)*(F1:F13=C4),),0))
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    04-17-2012
    Location
    mauritius
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Combining an AND and IF function - how to?

    Hi thanks for your reply. Actually the formulae works with that combination only; however if you either change the bank or currency, it no longer works.
    In cells C3 and C4 (there is a data validation in those cells) we can choose the bank and the currency, and depending on those two information, the account number will change. Do you think you can help?
    Thank you
    new user

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Combining an AND and IF function - how to?

    I tested and verified it still works if you change those cells. Just make sure that you change them to a valid combination. For example, there is no row with both "state" and "yen" so that would result in an error. Just like there is no row for "mcb" and "euro", so that combination will also result in an error. But if you change it to "bank one" and "suisse francs", which is a valid combination, it pulls the correct result, 67898.

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: Combining an AND and IF function - how to?

    You are probably picking two values from C3 and C4 that do not go together.

    Example:
    From your drop down I can pick state and yen, there is no match for that combination. To prevent this...

    =IFERROR(INDEX(G1:G13,MATCH(1,INDEX((E1:E13=C3)*(F1:F13=C4),),0)),"")
    HTH
    Regards, Jeff

  6. #6
    Registered User
    Join Date
    04-17-2012
    Location
    mauritius
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Combining an AND and IF function - how to?

    Right! Super Thank you very much! This is great!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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