+ Reply to Thread
Results 1 to 5 of 5

Thread: If statement and match function problem

  1. #1
    Registered User
    Join Date
    08-25-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    34

    If statement and match function problem

    I am trying to use a if statement and match function to find the cost from the Tab called Cost to the main tab. But I need to match the type and Error (Column B and C) together to find the cost from the cost tab.

    Here is my attempt but I got 0, it should be 50.
    =IFERROR(VLOOKUP(B2:C2,Cost!A2:C8,MATCH(Main!B2:C2,Cost!A2:B7,0),FALSE),0)
    Attached Files Attached Files
    Last edited by Batman11692003; 10-16-2011 at 01:14 PM.

  2. #2
    Valued Forum Contributor tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    USA
    MS-Off Ver
    Excel 2003 - 2007
    Posts
    2,342

    Re: If statement and match fumction problems

    Batman11692003,

    Attached is a modified version of your example workbook. In cell D2 of sheet 'Main' is the following formula:
    =SUMPRODUCT(--(Cost!$A$2:$A$7=B2),--(Cost!$B$2:$B$7=C2),Cost!$C$2:$C$7)

    And then its copied down.
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

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

  3. #3
    Valued Forum Contributor tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    USA
    MS-Off Ver
    Excel 2003 - 2007
    Posts
    2,342

    Re: If statement and match fumction problems

    Alternative formula, because you're using a .xlsx file:
    =SUMIFS(Cost!$C$2:$C$7,Cost!$A$2:$A$7,B2,Cost!$B$2:$B$7,C2)
    Hope that helps,
    ~tigeravatar

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

  4. #4
    Registered User
    Join Date
    08-25-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: If statement and match fumction problems

    Thanks for your help. But could you explain why I could use if and match function.

  5. #5
    Registered User
    Join Date
    08-25-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: If statement and match fumction problems

    How would I leave it blank instead of showing a 0 if there were no values plugged into the cell

+ 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.2.0