Excel - Sum/Count of boolean values - excel

In Excel I am creating a simple scorecard for my Football Pool. Each week a player makes a prediction and the correct guess is in the bottom row.
This is a simplified version of it
Name
Week1
Week2
Week3
Total
Lee
BUF
LAR
TB
3
Beth
BUF
SEA
TB
2
Rick
TEN
LAR
TB
2
Fred
TEN
LAR
PIT
1
Winner
BUF
LAR
TB
My question is about keeping score. To compute the total in Column F I am currently adding the booleans manually:
=(B2=B$7)+(C2=C$7)+(D2=D$7)
This is fine for only three columns of course, but it will definitely get quite cumbersome if there are dozens (or more) columns.
I am wondering if there is a simpler way to accomplish this with a formula such as SUM() or SUMIFS() or COUNTIFS() etc.
Any help would be greatly appreciated. Thanks! :)

Use SUMPRODUCT:
=SUMPRODUCT(--(B2:D2=$B$7:$D$7))

Related

Excel Table of Daily hours summarized by week number for a user

I'm having a hard time getting my head around what I think is a simple enough problem.
I have an Excel table of hours by day for each user i.e.:
Date1, Date1+1, Date1+2, Date1+3,... Date1+n
User1 8 8 4 6 ... 2
User2 5 2 8 3 ... 7
User3 0 7 5 0 ... 8
For forecasting purposes this grid looks several months into the future.
I do my work daily, others want it by week. I'd like to automatically generate the same table of data but rolled up by WeekNum.
I tried setting a year-weeknum at the top of the daily table and then using a SumIfs function to compare the user name and week num to sum up the daily hours in another tab for weekly data but I just couldn't get it to function properly.
=SUMIFS('Act - Forecast Hours'!$G$6:$AAL$35,'Act - Forecast Hours'!$A26,$A25,'Act - Forecast Hours'!S$4,O$3)
I think I'm overcomplicating a solution, any help is appreciated.
TIA
Rob
OK, I may have come up with an approach.
Since on my main Hourly Sheet the format is fixed, i.e. each week is 7 days and increments.
I setup a second sheet where I called a vertical and a horizontal offset and used the following formula:
=SUM(OFFSET('Act - Forecast Hours'!$G$9,$A5,D$2,1,7))
$A5 and D$2 refer to offset counts that increment by 7. As you copy the formula to each cell it increments the Row / Column to point to the right spot. Then for the Height and Width I look at a grid 1 row high and 7 wide to select each day of the week.
It works, I'm happy. I'm certainly interested in a more refined approach if there is one :-)
Thank You to anyone that does read through the question!
Regards
Rob

Unsure which function would work in Excel (IF-THEN, VLOOKUP, etc)

I am coding something for a yearly tournament I do. Scores need to be listed in 2 spots on the form, but I don't want to have to manually enter them in both spots to avoid mistakes.
Buffalo 1 Detroit 2
Carolina 4 Los Angeles 6
Chicago 2 Nashville 0
Colorado 3 New York 1
Is there a way to code another cell to find the value of "Buffalo" (for example) in either column A or C and return the value directly to the right (in column B or D). Because values listed above may switch around when I do the game schedule, I need the 2nd set of scores to be "smart" in that they can find "Buffalo" in either of those columns and give me the correct value.
I've been doing some trial and error using different functions and haven't been able to figure it out yet.
Thanks in advance for your help!
enter image description here
use SUMIF()
=SUMIF($A$1:$C$4,G2,$B$1:$D$4)
Note the same size but offset ranges.

Excel Graphs - Exclude someone who is off

I have data, in two separate columns, that shows people and how many products they have sold in the previous day:
Alan 12
Gareth 7
Kristina 8
Fred Off
Emma 7
What I would like to do is not include Fred in the graph as he was off for that day. Is there an easy way to exclude someone if they were "off"?
Any ideas are appreciated :)
Just Add a filter in those columns. Now filter the column to remove the value Off. The graph will be updated automatically.

sports scoring in multiple phases in excel

I have a question about excel.
There is a sports tournament with multiple phases. And the results page looks something like this:
rank phase1 phase2
1 TOM ALBERT
2 MATT TOM
3 ROBIN MATT
The first place gets 5 points, second 3 and third 1 points.
So the summary I would like to get is like this
rank name phase1 phase2 total
1 TOM 5 3 8
2 ALBERT 0 5 5
3 MATT 3 1 4
4 ROBIN 1 0 1
I cant figure out how to generate it simply, so if I copy-paste the results from phase3 to somewhere in my excel sheet, the summary page would also update.
If you can support me with advice or just a working template, I would be thankful!
Thank you for your time!
I've done you a basic example below...just list all 50 players in the summary page and copy the formula down as it is - as per the question it only records a value for the top 3 places, hope this helps if not please let me know :)
Example file here
Assuming the structure you defined and that when you paste phase 3 it will have its header ("phase3") on the same row as the other results, you could have the following formula on your Table 2:
{=SUM(IF(IFERROR(MATCH($B2,INDIRECT("Sheet1!"&CHAR(64+MATCH(C$1,Sheet1!$1:$1,0))&":"&CHAR(64+MATCH(C$1,Sheet1!$1:$1,0))),0)-1,0)={1,2,3},{5,3,1},0))}
Note: entered as Array formula: CTRL + SHIFT + ENTER
Formula uses the Table 2 headers ("phase1","phase2", etc.) and the players names to find the results for each phase. It then uses the predefined arrays that determine points given per position. The final sum is to bring the result that are in array (other values in array are 0) into single value.
Total would sum results per player.
Under the rank cells you would place the following formula:
=RANK(F2,$F:$F)
Which would provide you the rank of each player (Column F containing the totals).
Note that this would not sort your rank automatically but you could easily do this with Sorting or Autofilter. Hope this helps. Cheers.

Excel pivot table that counts non-numeric data?

I'm helping a coworker with a problem and I've run into a bit of a wall myself. He receives a CSV file from a survey of student responses after a set of classes are completed, and he wants to generate reports showing the number of responses in each category in each question (i.e. # Agree, # Strongly Agree, etc).
The CSV file has a format similar to this:
DateTime School Class Question 1 Question 2 Question 3 ... etc ...
======== ====== ===== ========== ========== ==========
1/1/2012 A 1 Agree Strongly Agree Disagree
1/1/2012 A 1 Disagree Agree Strongly Disagree
1/1/2012 A 2 Agree Strongly Agree Slightly Disagree
1/1/2012 A 1 Agree Agree Disagree
1/1/2012 A 2 Disagree Disagree Disagree
... etc 8,000 rows ...
What he would like is a report that looks similar to this:
School Class Q1 Agree Q1 Disagree ... Q1 Strongly Agree ...
====== ===== ======== =========== =================
A 1 2 1 0
A 2 1 1 0
... etc ...
Obviously I'm looking at a pivot table, but I'm running into an issue with how to define the pivot table. I'm not an expert at Excel, but when we tried various options we came up with essentially non-sensical results.
Is it possible to set up a pivot table that will give this data in a meaningful way? Counting instances of non-numeric values and grouping the counts by school and class? What would be a good (easily repeatable) strategy to accomplish this?
Thanks for any help, much appreciated.
(We are using Office 2007)
Select your datarange as a pivottable.
Drag Question 1, Class, and School to the Row Labels box.
Drag Question 1, Question 2, and Question 3 to the Values box.
If it doesn't say "Count of Question 1", click the downward arrow on Value Field Settings.
In the Summarize by tab, select Count.
Repeat as neccesary.
On another sheet, link to the specific pivot table cells to display the data in whatever format you wish.
edit: I have attached an image as a visual aid.
http://i.imgur.com/2Emw3.jpg
Let me know if you have any questions.
Fill a second sheet with formulas that concatenate School and Class and Answer.
The table would afterwards look like this:
Q1 Q2 Q3
=================================================================
A1Q1:Agree A1Q2:Strongly Agree A1Q3:Disagree
A1Q1:Disagree A1Q2:Agree A1Q3:Strongly Disagree
A2Q1:Agree A2Q2:Strongly Agree A2Q3:Slightly Disagree
Where A1 means School A Class 1.
You could even work with VLookup to replace the text with numbers
You can get this by adding this formula to Cell D3 in the dummy table:
=sourcetable!$B3&sourcetable!$C3&D$1&":"&sourcetable!D3
and then copy it to every cell.
Now all you have to do is create a result table like this:
Q1 Q1 Q1
School Class Agree Disagree Strongly Disagree
========================================================================
A 1 formula
where formula is
=countif(dummytable!C3:z999,$A4&B4&C$1&":"&C$2)
repeat this formula for all cells.
What the first part does and how it does it should be clear. In a production-level application I would replace the text (Agree/Disagree) with numbers (google for VLookup) the you see when there's a typo in the data.
The second part counts all occurrences of the string (in this case A1Q1:Agree). This should do the trick.
If you want to publis it, it is a good Idea to "copy:paste values" the result into a new table...
You can reuse the dummytable and the result table as is. Just drop the new data into sourcetable...
The issue is that your data is all ready partially pivoted.
Ideally it would be in the format:
DateTime School Class Question Answer
======== ====== ===== ========== ==========
1/1/2012 A 1 Question 1 Strongly Agree
1/1/2012 A 1 Question 2 Agree
etc
That format would lend itself to better work with a pivot table.
Here is instructions on doing an unpivot with Excel 2016

Resources