Consulting

Results 1 to 6 of 6

Thread: A complex IF formula

  1. #1
    VBAX Regular
    Joined
    Jun 2008
    Posts
    52
    Location

    A complex IF formula

    Hi,

    I have to calculate some fees with a complex condition. Here it comes:
    (see example sheet attached)

    Every SELL is EUR 0.20
    Every BUY is EUR 0.20 BUT only the first Buy trade per day per symbol has to pay 0.50 more (so a total of EUR 0.70)

    Can somebody help me with this?

    Thanks in advance and kind regards,

    Riaaz66

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    =IF(B2="S",0.2,0.2+(SUMPRODUCT(--($A$2:A2=A2),--($D$2:D2=D2))=1)*0.5)
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Without an IF

    =0.2+(SUMPRODUCT(--($A$2:A2=A2),--($B$2:B2="B"),--($D$2:D2=D2))=1)*0.5
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Regular
    Joined
    Jun 2008
    Posts
    52
    Location
    Quote Originally Posted by xld
    =IF(B2="S",0.2,0.2+(SUMPRODUCT(--($A$2:A2=A2),--($D$22=D2))=1)*0.5)
    Hi Xld,

    I tried both formulas. the last one doesn't work. The first one works partly.

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    More detail because it worked absolutely as you predicted for me on your example workbook.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    you guys have lots of great info in here.

Posting Permissions

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