Need help automating my sheet

Nebul0us

New Member
Joined
Sep 18, 2017
Messages
6
I need help automating this sheet. I want to highlight the winning team on the left, then have the losing teams automatically highlighted for every person. After that I want the total highlighted cells to be counted and output at the bottom for each person. Please see my example I hope I made sense....



3Spxs2Z.jpg
 
Unfortunately, those sites are blocked for me (for the same Corporate Security Policy I mentioned earlier...)

That is why we usually recommend the tools included in my link - the maximum number of users will be able to see it. Otherwise, you may be limiting your pool of potential helpers.


I simply used the built-in "insert image" button on this forum...

Can anyone that is not limited by their corporate settings help with my OP?
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I can see the image from home (which is where I am right now).

Unfortunately, Conditional Formatting runs off of cell's values, not manual formatting. So I don't know of any way of doing what you want without doing a bunch of VBA, which I think will then have to be called to run manually.

If, however, you entered the winner into some cell, instead of just highlighting it, you could use Conditional Formatting to do all your highlighting without having to use VBA.
 
Upvote 0
I can see the image from home (which is where I am right now).

Unfortunately, Conditional Formatting runs off of cell's values, not manual formatting. So I don't know of any way of doing what you want without doing a bunch of VBA, which I think will then have to be called to run manually.

If, however, you entered the winner into some cell, instead of just highlighting it, you could use Conditional Formatting to do all your highlighting without having to use VBA.

I guess the VBA is why I am here. I could do the extra cell with the winners....but how would I then total number wrong (highlighted) at the bottom for each person?
 
Upvote 0
OK. I cannot see the sheet again because I am back at work, so I am just going to set up a simple example to show you how to get your counts if you use a new column for the winners.

Let's say that you insert a column into column A for your winners, and columns B and C are the listing of the two teams.
Now let's say that your first person is in column D. And the games are listed in rows 2-17.
Then, to count the number of matches (games they got right), you can enter this formula in cell D18:
Code:
=SUMPRODUCT(COUNTIF(D2:D18,$A2:$A18))
If you instead want to return the number they got wrong, just subtract this number from the total number of games, i.e.
Code:
=COUNTA($A2:$A18)-SUMPRODUCT(COUNTIF(D2:D18,$A2:$A18))

I think that should give you what you want.

To read more on the method I used for the counts, see this: https://exceljet.net/formula/count-total-matches-in-two-ranges
 
Upvote 0
Note: Another trick you can do to make it so you can simply select the winner instead of having to type it is to use Data Validation.
For example, if you wanted cell A2 to list the entries in B2 and C2, then:
- highlight A2,
- select Data Validation
- in the Allow field, choose the List option
- in the Source field, enter this formula: =B2:C2
-
copy down for all rowsNote that you will want to type in the Source field and not select the cells (selecting with include absolute range references, so when you copy it down, it wouldn't adjust and all would be looking at B2 and C2).
 
Upvote 0
Apart from some people not being able to see the images, nobody can copy/paste from them and many potential helpers will simply bypass your thread because they (understandably) don't want to be bothered typing out a whole heap of data to test with. The alternatives Joe has pointed you to can be copied from so give you a much greater change of getting helpers - and more quickly.

It was the same issue for me, so I have just made up a small example, which also relies on an extra column (A) to hold the winner. Then all the coloured cells get that way with the Conditional Formatting shown, & a slightly simpler formula to count each person's losing choices.
- Select B3:C?? and apply the green CF
- Select D3:End and apply the losing CF
- Formula in D10 is copied right.

Excel Workbook
ABCDEFGHIJKL
2WinnerHomeAway
3KCKCNENEKCKCNENEKCKCNENE
4BUFNYJBUFNYJBUFNYJNYJBUFNYJNYJBUFBUF
5ATLATLCHICHICHICHIATLATLCHICHIATLATL
6BALBALCINBALBALBALCINBALBALBALBALBAL
7PITPITCLECLECLEPITCLEPITCLECLEPITCLE
8DETAZDETDETDETDETDETDETDETDETAZAZ
9
10Missed422413323
Losers
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B31. / Formula is =B3=$A3Abc
D31. / Formula is =D3<>$A3Abc
 
Last edited:
Upvote 0
OK. I cannot see the sheet again because I am back at work, so I am just going to set up a simple example to show you how to get your counts if you use a new column for the winners.

Let's say that you insert a column into column A for your winners, and columns B and C are the listing of the two teams.
Now let's say that your first person is in column D. And the games are listed in rows 2-17.
Then, to count the number of matches (games they got right), you can enter this formula in cell D18:
Code:
=SUMPRODUCT(COUNTIF(D2:D18,$A2:$A18))
If you instead want to return the number they got wrong, just subtract this number from the total number of games, i.e.
Code:
=COUNTA($A2:$A18)-SUMPRODUCT(COUNTIF(D2:D18,$A2:$A18))

I think that should give you what you want.

To read more on the method I used for the counts, see this: https://exceljet.net/formula/count-total-matches-in-two-ranges

Okay so this will work but how would I compare a range of cells, then skip a row, and include another cell of a column to that of another column? Skipping the row seems to mess me up. I'm using =SUMPRODUCT(COUNTIF(E3:E17,E19=$C$3:$C$17,$C$19))
How can I skip row 18?
 
Upvote 0
Okay so this will work but how would I compare a range of cells, then skip a row, and include another cell of a column to that of another column? Skipping the row seems to mess me up. I'm using =SUMPRODUCT(COUNTIF(E3:E17,E19=$C$3:$C$17,$C$19))
How can I skip row 18?
Maybe write two separate equations (one for each range) and simple add them up.
Code:
=Formula1 + Formula2
 
Upvote 0
How can I skip row 18?
What is it about row 18 that means it needs to be skipped? Is it at all related to the image you originally posted (the first game from Monday night)?
If not, could you post another small set of sample data (preferably one we can copy from) & explain in relation to that? We could then also see what E19 and $C$19 have to do with it.
 
Last edited:
Upvote 0
I think I got it to do what I needed. Not as pretty as it could be with some VBA, but works for me. Thank you all for your help I really appreciate it.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top