+ Reply to Thread
Results 1 to 6 of 6

Thread: What is wrong with my IF compare statement?

  1. #1
    Registered User
    Join Date
    01-27-2006
    Posts
    12

    Question What is wrong with my IF compare statement?

    Can someone tell me what is wrong with this formula? Is it too ambiguous? If so, how can I make it more specific?

    The formula is on Sheet 3

    =IF(E:E <> 'Sheet2'!C:C,SUMIF('Sheet1'!E:E,E:E,'Sheet1'!C:C),0)

    What I'm trying to do is pull in $ values from Sheet 1, into Sheet 3, if the deduction code for this $ value doesn't exist on Sheet 2.
    Last edited by Idz21; 03-10-2010 at 09:49 AM.

  2. #2
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,785

    Re: What is wrong with my IF compare statement?

    well.... that will never work post a workbook showing expected results
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and a dabbler in Cisco
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    01-27-2006
    Posts
    12

    Re: What is wrong with my IF compare statement?

    Quote Originally Posted by martindwilson View Post
    well.... that will never work post a workbook showing expected results
    Attached is the Sample Spreadsheet. If you look in Sheet 3, you'll see the expected result for Column B (highlighted in grey). What needs to happen is that anytime a Deduction Label exists in Sheet 1, and does not exist in Sheet 2, then I need to replicate this deduction in Sheet 3.
    Attached Files Attached Files

  4. #4
    Forum Guru ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    traded up
    MS-Off Ver
    2003 & 2010
    Posts
    1,905

    Re: What is wrong with my IF compare statement?

    Try this:

    =IF(COUNTIF(Sheet2!$B$1:$B$20,C2),0,INDEX(Sheet1!$A$1:$C$20,MATCH(C2,Sheet1!$C$1:$C$20,0),1))
    Amend the ranges as necessary, and copy down.

    Cheers,
    “To sin by silence when they should protest makes cowards of men.” ~ Abraham Lincoln

  5. #5
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Childers QLD, Australia
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    100

    Re: What is wrong with my IF compare statement?

    Hi,

    I have edited you cells in column B on sheet 3 and re-attached your sample.


    =IF(COUNTIF(Sheet2!B:B,C5)=0,SUMIF(Sheet1!C:C,C5,Sheet1!A:A),0)

    It works.

    Cheers

    Tony
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-27-2006
    Posts
    12

    Thumbs up Re: What is wrong with my IF compare statement?

    Quote Originally Posted by TonyB51 View Post
    Hi,

    I have edited you cells in column B on sheet 3 and re-attached your sample.


    =IF(COUNTIF(Sheet2!B:B,C5)=0,SUMIF(Sheet1!C:C,C5,Sheet1!A:A),0)

    It works.

    Cheers

    Tony
    Thanks Tony! That worked for me. Appreciate the help.

    ConneXionLost - Thanks for posting your suggestion as well. If I find a scenario where Tony's solution no longer applies, I'll plug yours in and give it a shot.

+ 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