+ Reply to Thread
Results 1 to 10 of 10

SumIF based on a value in drop down box

  1. #1
    Registered User
    Join Date
    11-05-2007
    MS-Off Ver
    Mac 2011
    Posts
    98

    SumIF based on a value in drop down box

    Hi there,
    I am trying to put a formula in cell c42 based on the Value of Cell C2 which has a drop down box with "Buy" and "sell" however it keeps returning a value of zero.

    If you select "Sell" in C2 then the sum should be C4-C10*C3
    If you select "Buy" in C2 the the sum should be C10-C4*C3

    Please see formula below

    =SUM(IF(C2="Sell",C4-C10)*C3)*(IF(C2="buy",C10-C4)*C3)))

    If anyone can help me it would be greatly appreciated.

    Thanks
    Justin.
    Last edited by Justinmih; 05-08-2012 at 08:21 PM. Reason: Solved

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

    Re: SumIF based on a value in drop down box

    Hi Justin,

    Maybe something like

    =CHOOSE(MATCH(C2,{"Buy","Sell"},0),C10-C4,C4-C10)*C3
    HTH
    Regards, Jeff

  3. #3
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: SumIF based on a value in drop down box

    May be,

    =(C4-C10)*C3*IF(C2="Buy",-1,1)
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  4. #4
    Registered User
    Join Date
    11-05-2007
    MS-Off Ver
    Mac 2011
    Posts
    98

    Re: SumIF based on a value in drop down box

    Hi Jeffrey,
    thanks for the quick reply.
    It works when you select "Sell" however when you select "Buy" it comes up with #N/A. Any ideas?

    cheers
    Justin.

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

    Re: SumIF based on a value in drop down box

    @ Justin, I seem to have no problems with the formula. Check the spelling and make sure it is all the same.

    @ Haseeb, very nice as usual

  6. #6
    Registered User
    Join Date
    11-05-2007
    MS-Off Ver
    Mac 2011
    Posts
    98

    Re: SumIF based on a value in drop down box

    Hi Haseeb,
    Than you too for replying.
    What you have given me works for the "Buy" how does it work when sell is selected though?

    Cheers

    Justin.

  7. #7
    Registered User
    Join Date
    11-05-2007
    MS-Off Ver
    Mac 2011
    Posts
    98

    Re: SumIF based on a value in drop down box

    Hi Still no joy, just copied it across from yours.
    Would it be something to do with it being an Excel for Mac2011?

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

    Re: SumIF based on a value in drop down box

    I have no experience with Mac so I don't quite now, but does this sample help?
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    11-05-2007
    MS-Off Ver
    Mac 2011
    Posts
    98

    Re: SumIF based on a value in drop down box

    Hi Jeffrey,

    Just deleted the Buy and Sell and re-entered them into the drop dow list. It works perfect now.

    thanks again its much appreciated.

    cheers

    Justin.

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

    Re: SumIF based on a value in drop down box

    You're very welcome and glad to hear you got it all sorted. Thanks for the feedback.

+ 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