Results 1 to 7 of 7

Thread: Need help with Excel calculation ....

  1. #1

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Need help with Excel calculation ....

    I need the syntax for the following calculation.

    I can never get this right as there always seems to be loads of brackets involved.

    Any of you bright sparks out there fancy taking this one on ?

    IF J4=P4 AND K4=Q4 THEN
    Range("A1").Value = Range("A1").Value + 1
    ELSE
    IF (J4 > K4 AND P4 > Q4) OR (J4=K4 AND P4=Q4) OR (J4<K4 AND P4<Q4) THEN
    Range("A1").Value = Range("A1").Value + 1
    ENDIF
    ENDIF

    Hope thats readable !

  2. #2

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    OK almost done.

    All I need now is the correct Excel syntax for the following :

    IF (DJ38=H37 OR DJ38=I37) AND DJ38 <> F41 THEN
    5
    ELSE
    0
    ENDIF

    Any takers ?

  3. #3
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Need help with Excel calculation ....

    Originally posted by TheBionicOrange
    IF J4=P4 AND K4=Q4 THEN
    Range("A1").Value = Range("A1").Value + 1
    ELSE
    IF (J4 > K4 AND P4 > Q4) OR (J4=K4 AND P4=Q4) OR (J4<K4 AND P4<Q4) THEN
    Range("A1").Value = Range("A1").Value + 1
    ENDIF
    ENDIF

    Hope thats readable !
    That makes no sense - where is the formula going??

    This is the formula in a4
    Code:
    =IF(OR(AND(J4=P4,K4=Q4),OR(AND(J4>K4,P4>Q4),AND(J4=K4,P4=Q4),AND(J4<K4,P4<Q4))),1,0)
    That puts a 1 or 0 depending.. which you can either count or sum.


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    do you mean you want this in a cell formula?

    if so...
    Code:
    IF (  AND(   OR (DJ38=H37, 
                             DJ38=I37), 
                   DJ38 <> F41) 
         , 5
         , 0)

  5. #5
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Originally posted by TheBionicOrange
    OK almost done.

    All I need now is the correct Excel syntax for the following :

    IF (DJ38=H37 OR DJ38=I37) AND DJ38 <> F41 THEN
    5
    ELSE
    0
    ENDIF

    Any takers ?
    Code:
    =if(and(or(dj38=h37,dj38=i37),dj38<>f41),5,0)

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  6. #6

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    OK thanks for the help guys.

    I'm at home now and won't be back in till Monday, so I'll try then.

    Thanks again.

  7. #7

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    Thanks Ecniv ... that worked just fine

Posting Permissions

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



Click Here to Expand Forum to Full Width