• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Help with multiple variable formula

Jambo

New Member
I am attempting to create a spreadsheet to keep track of teams in our tournament.
Data include the team name, owner, handicap and the score of the game.

A B C D E F
Team Owner Handicap Score winner owner

1 Broncos Mary 1 55
2 Monsters Bob 40
3
4 Aliens Joe 99
5 Cowboys Sandy 70
6
7 Bears Ed 48
8 Killers Jim 9 50
9
10 Scamps Sam 6 54
11 Eagles Patty 77
12
13 Bucks Al 8 58
14 Dolphins Kate 50

The handicap is subtracted from the final score. There are five possible outcomes:
In the first scenario, the Broncos are the favorite and score enough to win even after their handicap is deducted.

In the second scenario, neither team is handicapped, so the Aliens win the game.

In the third scenario, the Killers outscore the Bears by 2, but the Killers have a 9 point handicap, making the Bears the winners.

In scenario four, the Eagles win the game outright, even before the Scamps' handicap is added.

In scenario five, the Bucks score 8 more points than the Dolphins, meaning that the score is effectively tied after subtracting the Buck's handicap. In this case, the rules state that the team with the handicap is declared the winner.

I need an equation that will take the score of each team, subtract the handicap of the team that has one (including the possibility that neither team has one) and then put the winning team and their owner in rows E and F, respectively.

I tried an IF equation like so:
=IF((D1-C1)>(D2-C2),A1,A2). That works in all the scenarios except #3 and 5, but the tie in 5 throws it off. So I changed it to:
=IF((D1-C1)>=(D2-C2),A1,A2). That only works in #5 if the team with the handicap is on the upper row.

Thoughts: There has to be a way to do this. Can an IF equation be used to determine which team has the handicap?
In plain language:
IFBLANK C2 then IF D1-C1 >=D2-C2 would work.
IFBLANK C1 then IF D2-C2>=D1-C1 would work.
How do you combine these into a working formula?

And just to add on an extra layer: How would you set conditional formatting so that if the team without the handicap wins because the handicap lowered the other team's score below theirs (scenario #3) to not only put that team and owners names in columns E and F but change the text color to red?

Whew. Thanks in advance to whoever takes a stab at this.
 
Here's the workbook with the information above. Unfortunately in my original post the data was not posted with the spacing intact.
Columns G and H contain the formula to determine the winner. For example, G5 contains: =IF((E5-D5)>=(E6-D6),B5,B6)
As you can see, this only works correctly in scenarios 1,2 and 4.
I'm sure that the answer lies in nested IF or IFBLANK, I just don't know how to do it.
 

Attachments

  • question.xlsx
    38.4 KB · Views: 4
Narayan:
Thank you!
It wasn't exactly correct, but you put me on the right path. I realized that in my original post I failed to mention that although the winning team moves on, if it does not win by enough to account for the handicap the owner of the losing team takes ownership of the winning team.
I realized that trying to move the winning team over and also account for the possible change in ownership all in one equation was unnecessary.
The winning team moves on no matter what. So, for the winning team all I needed was:
=IF((E5>E6),B5,B6)
To move the owners over (and account for possible ownership change) I adapted your equation to:
=IF((E5 - D5) > (E6 - D6), C5, IF((E5 - D5) = (E6 - D6), IF(D5 > D6, C5, C6), C6))

It works like a charm.
Thank you again.

Part 2: can conditional formatting be incorporated into an equation? If the result of the =IF((E5 - D5) > (E6 - D6), C5, IF((E5 - D5) = (E6 - D6), IF(D5 > D6, C5, C6), C6)) equation is that the owner with the blank in column D is the owner that moves on (taking over the winning team), I want to change the font color of both the winning team and the owner who took it over to red.
 
Hi ,

Conditional Formatting can work independently of a cell formula , since it is within the Conditional Formatting rule.

Thus , you can have one formula in a cell , and another formula to conditionally format the same cell or any other cell for that matter.

If you can upload your workbook with the data , and indicate which cells should be colored with which colours , the CF rules (formulae) for doing what you want can be written.

Narayan
 
How can I incorporate conditional formatting to automatically change the color of the text where the team was taken over by a new owner? In this workbook it would be in scenario #3, cells G11 and H11.
 

Attachments

  • Question2.xlsx
    9.8 KB · Views: 3
Last edited:
Back
Top