+ Reply to Thread
Results 1 to 14 of 14

Formula not working out correctly

  1. #1
    Registered User
    Join Date
    06-09-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    26

    Formula not working out correctly

    I have a formula in which for all intensive purporses was going great.........

    Until I ran into a slight problem.

    As I have posted in other threads trying to get help (though I worked it out on my own in the end), I am doing a soccer prediction league and wanted to run things smoothly.

    Here is my formula:

    Please Login or Register  to view this content.
    I realise its a lot of ifs and ands but it was doing the job.

    formula help.png

    Above is a copy of the spreadsheet. In column G I write the scores manually as 2-1 etc, but in column H and I I use =IF(G3="","",LEFT(G3,FIND("-", G3)-1)) to seperate them (use right for I).

    The above IF and AND formula is in column J to calculate the points earned.

    My issue is, the game finished 0-0, and all the ones with 1 points are correct as although they predicted the wrong outcome, they at least got 1 teams amount of goals correct. However the players that got 3 points are clearly wrong. They didn't predict a draw nor did they get a teams goals right.
    If I changed one of the teams results to 2-0, then they are changed to 1 point. If I change the actual score to 1-1 (G2) instead of 0-0, the all the scoring wins still get 3 points. Only seems to occur to games where both teams score, and a win is determined.

    I'm sorry if I don't make any sense, but this is really bugging me now.

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: Formula not working out correctly

    I understand what is going on with Columns G, H & I..

    Not very sure what is required in Column J..

    Can you re-explaing in slightly simpler words?

    Also I did not understand how did you conclude that the predicted result was right/wrong?
    Cheers!
    Deep Dave

  3. #3
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,941

    Re: Formula not working out correctly

    AND($H$2>H3,$I$2>I3,$H$2=H3)
    AND($H$2<H3,$I$2<I3,$H$2=H3)
    The colored ones is not possible - if h2>h3 then how h2=h3 will be
    all the and functions will not work straightaway it give false in if condition
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula not working out correctly

    That part looks wrong...
    IF(AND($H$2=H3,$I$2=I3)=1,
    I dont think the =1 should be there. That needs to read IF H2=H3 AND I2=I3, then do "this", ELSE do "that". You cannot have an AND() = something, it will either return a TRUE or a FALSE.

    I did not look further into your formula, because I see that same error repeated (although Siva has picked up another problem)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    06-09-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Formula not working out correctly

    Column J is where I work out my points.

    The long formula with the IFS and ANDS goes into J3 in which it then works out whether a participant gets 5 points for predicting the entire result correctly (so if game finished 3-0 and they predict 3-0). They get 4 points if they get the score correct, but only 1 teams goals (so again, predicted 3-0 but game finished 3-1). 3 Points for correct result (3-0 prediction, 2-1 result). 1 point for a losing prediction BUT participant guesses correctly 1 teams goal count.

    Hopefully the above paragraph answers both your questions.

    Here is the formula again, in quote brackets instead of code.

    =IF(I3="","",IF(AND($H$2=H3,$I$2=I3)=1,5,IF(AND($H$2>H3,$I$2>I3,$H$2=H3)=1,4,IF(AND($H$2<H3,$I$2<I3,$H$2=H3)=1,4,IF(AND($H$2>H3,$I$2>I3,$I$2=I3)=1,4,IF(AND($H$2<H3,$I$2<I3,$I$2=I3)=1,4,IF(AND($H$2>H3,$I$2>I3)=1,3,IF(AND($H$2<H3,$I$2<I3)=1,3,IF(AND($H$2=$I$2,H3=I3)=1,3,IF(AND($H$2>H3,$I$2<I3,$H$2=H3)=1,1,IF(AND($H$2<H3,$I$2>I3,$H$2=H3)=1,1,IF(AND($H$2>H3,$I$2<I3,$I$2=I3)=1,1,IF(AND($H$2<H3,$I$2>I3,$I$2=I3)=1,1,IF(AND($H$2>$I$2,H3=I3,$H$2=H3)=1,1,IF(AND($H$2<$I$2,H3=I3,$H$2=H3)=1,1,IF(AND($H$2>$I$2,H3=I3,$I$2=I3)=1,1,IF(AND($H$2<$I$2,I3=H3,$H$2=H3)=1,1,IF(AND($H$2=$I$2,H3>I3,$H$2=H3)=1,1,IF(AND($H$2=$I$2,H3<I3,$H$2=H3)=1,1,IF(AND($H$2=$I$2,H3>I3,$I$2=I3)=1,1,IF(AND($H$2=$I$2,I3<H3,$H$2=H3)=1,1,0)))))))))))))))))

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula not working out correctly

    Perhaps you missed post #4? (you posted almost when I did)

  7. #7
    Registered User
    Join Date
    06-09-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Formula not working out correctly

    Quote Originally Posted by nflsales View Post
    AND($H$2>H3,$I$2>I3,$H$2=H3)
    AND($H$2<H3,$I$2<I3,$H$2=H3)
    The colored ones is not possible - if h2>h3 then how h2=h3 will be
    all the and functions will not work straightaway it give false in if condition
    I think I have found exactly where I went wrong with your help.

    Tiredness kicking in and making simple mistakes.

  8. #8
    Registered User
    Join Date
    06-09-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Formula not working out correctly

    Quote Originally Posted by FDibbins View Post
    That part looks wrong...

    I dont think the =1 should be there. That needs to read IF H2=H3 AND I2=I3, then do "this", ELSE do "that". You cannot have an AND() = something, it will either return a TRUE or a FALSE.

    I did not look further into your formula, because I see that same error repeated (although Siva has picked up another problem)
    Quote Originally Posted by FDibbins View Post
    Perhaps you missed post #4? (you posted almost when I did)
    I have removed the =1.

    I have also taken on board what Siva wrote and hopefully I've corrected the issue.

    Thank you guys.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula not working out correctly

    Great, looking forward to seeing how you make out

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula not working out correctly

    I was just looking at your formula again, after trying to clean it up a bit, and it seems you repeat the same condition a few times. Take a look at just the 1st few IF's...
    IF(AND($H$2=H3,$I$2=I3),5,
    IF(AND($H$2>H3,$I$2>I3),4,
    IF(AND($H$2<H3,$I$2<I3),4,
    IF(AND($H$2>H3,$I$2>I3),4,
    IF(AND($H$2<H3,$I$2<I3),4,
    IF(AND($H$2>H3,$I$2>I3),3,
    IF(AND($H$2<H3,$I$2<I3),3,

    Im sure there are many more like this

  11. #11
    Registered User
    Join Date
    06-09-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Formula not working out correctly

    Done it without issues.

    Removed the =1, and sorted some of the cells to where they should be on the formula and it worked a treat.

    Thanks..

    Here is the new formula.

    Please Login or Register  to view this content.

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula not working out correctly

    OK, looks like you have resolved it

  13. #13
    Registered User
    Join Date
    06-09-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Formula not working out correctly

    Quote Originally Posted by FDibbins View Post
    I was just looking at your formula again, after trying to clean it up a bit, and it seems you repeat the same condition a few times. Take a look at just the 1st few IF's...
    IF(AND($H$2=H3,$I$2=I3),5,
    IF(AND($H$2>H3,$I$2>I3),4,
    IF(AND($H$2<H3,$I$2<I3),4,
    IF(AND($H$2>H3,$I$2>I3),4,
    IF(AND($H$2<H3,$I$2<I3),4,
    IF(AND($H$2>H3,$I$2>I3),3,
    IF(AND($H$2<H3,$I$2<I3),3,

    Im sure there are many more like this
    I had the cells in the wrong place, thats where I messed up. Hopefully the updated one makes more sense.
    I wish I could tidy it up more but I wouldn't know where to start, and it hopefully is now working like a dream.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Formula not working out correctly

    1 way to try and help make sense of a big formula, is to break it down (in the formula bar) into separate rows for each component part. Click where you want to "break" the formula and press ALT enter. That will not actually ENTER the formula, it will make everything to the right of the cursor, jump to the next line in the formula bar.

    You can make teh formula bar wider by click/dragging the bottom of the "typing area". Splitting a formula like this, has no effect on how it operates, but can make it easier to comprehend and follow

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formula not working correctly
    By Burt_100 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-21-2014, 07:08 AM
  2. If then formula not working correctly
    By chappie97 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-23-2013, 01:22 AM
  3. [SOLVED] IF formula not working correctly
    By ErikaC in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-18-2013, 03:38 PM
  4. Using the lookup formula but is not working correctly
    By susiesc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-31-2013, 03:38 PM
  5. Replies: 9
    Last Post: 03-08-2013, 11:50 AM

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