I am creating a score sheet in which I would like to count how many times a person played in a specific month. The formula will be on a separate tab/sheet. The table of data will look similar to this:
Month Player1 Player2 Player3 Player4
January Bob Joe Ed John
January Joe Scott Bob Dan
January Dan John Ed Scott
February Bob Ed Joe Dan
February Dan John Ed Scott
February John Ed Bob Dan
I would like to count how many times Bob played in the month of January. This is the code I've tried and it counts only the first roll of my sheet. For example, I get the result of only "1" for Bob in the month of January.
=COUNTIF(INDEX(Scoreboard!$B$2:$H$282,MATCH(Scoreboard!$O2,ScoreBoard!$A$2:$A$282,0,),""&Names!R$5&"")
The "Names" tab will have all the players name and count the number of games played for the selected month. Cell "O2" is where I select which Month I want to see.
Any help will be appreciated!
With data in columns A through E, in G1 enter the month of interest. In H1 enter the name of interest. The in another cell enter:
=SUMPRODUCT(--(A1:A100=G1) * (B1:B100=H1))+SUMPRODUCT(--(A1:A100=G1) * (C1:C100=H1))+SUMPRODUCT(--(A1:A100=G1) * (D1:D100=H1))+SUMPRODUCT(--(A1:A100=G1) * (E1:E100=H1))
Alternatively, you could use a pivot table.
Related
I have some data in one sheet 1 that has the Pupil Name and some other pupil related data.
For example:
Pupil Name
Joe Bloggs
Terry Jones
Peter Smith
John Doe
Lenny Peter
Harry Potter
In another sheet (sheet 2) a list of teachers and the corresponding pupils they will be conducting the interview with. Each teacher will have upto 6 interviews and these are in columns Candidate 1 to Candidate 6.
For example
Teacher, Candidate 1, Candidate 2, Candidate 3, Candidate 4, Candidate 5, Candidate 6
Mrs Smith, Joe Bloggs, Terry Jones, Peter Smith, John Doe, Lenny Peter, Harry Potter
In sheet 1, I would like to bring back the name of the interviewer back into the pupil sheet. I've tried INDEX and Match by even adding the column headers in the column match but this only brings back those interviewers in the Candidate 1 column and not the other 5 columns. Is there a way to do this?
Thanks,
You'd need something like the following in B2:
=INDEX(Sheet2!A$2:A$100,SUMPRODUCT((Sheet2!B$2:G$100=A2)*(ROW(B$2:G$100)))-1)
Obivously the 100 needs to be swapped with a rownumber that your data on Sheet2 ends.
You can use HLOOKUP.
Here is my take on the issue Example worksheet
I used the following formula in the second column =+HLOOKUP(A2;$E$2:$K$3;2;0)
What I'm essentially looking to do is be able to track to see how many refills our patients have received. I have a list of what was sent to the pharmacy, and what the pharmacy has returned. What I would like to do is fill in Column C on Sheet 1, which will track if the patient received any refills after their initial prescription fill. As below, patients can get more than one prescription in any month for different drugs. All I'm looking to do is count how many months they received something after their first month's fill.
In this example, Patient John would have 2 months of refills, Adam would have 0 (or No fills at all), Bob would have 0 refills, and Phil would have 1 refill month.
Thanks!
Sheet 1
A B C
Date Patient Refills
1/1/18 John
1/2/18 Adam
1/3/18 Bob
1/4/18 Phil
Sheet 2
A B C
Date Filled Patient Prescription
1/10/18 John Drug A
1/10/18 John Drug B
1/12/18 Bob Drug A
1/12/18 Bob Drug B
1/12/18 Bob Drug C
1/13/18 Phil Drug C
2/10/18 John Drug A
2/10/18 John Drug B
2/13/18 Phil Drug C
2/13/18 Phil Drug D
3/10/18 John Drug A
Well here are a couple of formulas which go some way towards addressing the problem.
The first one is just a standard formula for counting the number of different dates for John which can be pulled down for the other patients
=MAX(SUM(--(FREQUENCY(IF(B$2:B$12=F2,A$2:A$12),$A$2:$A$12)>0))-1,0)
The next one is counting the number of different months for John, and can also be pulled down for the other patients. In this case, two different dates for the same patient in the same month would be counted as one:
=MAX(SUM(--(FREQUENCY(IF(B$2:B$12=F2,MONTH(A$2:A$12)),MONTH($A$2:$A$12))>0))-1,0)
Both these have to be entered as array formulas using CtrlShiftEnter
I have changed the data slightly to show the difference between the two formulas
Note that these formulas have limitations as mentioned in the comment, where the prescription dates might split across the end of a month in your real data, or if they span multiple years, in which case you would need a more sophisticated approach.
on sheet1, column c2
=COUNTIFS(Sheet2!B:B,Sheet1!B2,Sheet2!A:A,">" & A2)
I'm doing this in powerpivot Excel 2013
So i have a table what looks a little like this:
name debit/credit amount Date
Jane C €10,00 01-01-2013 01:00
Jane C €10,20 01-01-2013 06:20
Jane D €12,30 03-01-2013 14:13
ETC
The table is sorted by date
I want to create an extra column in my data model so the table looks like this:
name debit/credit amount Date Balance
Jane C €10,00 01-01-2013 01:00 €10,00
Jane C €10,20 01-01-2013 06:20 €20,20
Jane D €12,30 03-01-2013 14:13 €7,90
ETC
Any advice how to do this?
You need to use DAX CALCULATE for this.
To simplify it a bit I first added a column:
=if([debit/credit]="C",[amount],-[amount])
Then I did balance with this:
Balance = CALCULATE(sum([adjAmount]),FILTER('Table1',[date]<=EARLIER([date])))
It is possible to do it with a single formula but it is more complicated than my sluggish brain can handle now.
UPDATE
Sorry, I missed out on the condition for handling multiple names.
Balance =CALCULATE(sum([adjAmount]),FILTER('Table1',AND([date]<=EARLIER([date]),[name]=EARLIER([name]))))
Just use two SUMIF functions, one to sum the credit and one to sum the debit, then subtract the debit from the credit. Use one absolute reference and one relative so that when it is copied down the column the absolute reference remains the same. Enter this into E2 and drag down:
=SUMIF($B$2:B2,"C",$C$2:C2)-SUMIF($B$2:B2,"D",$C$2:C2)
I have sheet with a list of users and their holidays taken like so:
Katie 1 01/01/2016
Dave 2 12/02/2016
Dave 2 12/12/2015
Katie 1 17/11/20165
Liam 1 05/01/2016
Marie 1 09/08/2015
Marie 5 23/09/2015
I am then using the following SUMIF formula on my other sheet to return the total number of holidays taken for each person
=SUMIF(Data!A$1:A$1000,A13,Data!B$1:B$1000)
This gives me a result like so:
Katie 2
Dave 4
Liam 1
Marie 6
However, now I want to turn my SUMIF into a SUMIFS which only returns the values for the month of January like so:
Katie 1
Liam 1
I know I can get the month of the date by using =TEXT('Cell Ref',"mmmm") but I'm not sure how I would combine this into an SUMIFS statement.
Can someone please show me how I can do this?
Thanks in advance
You would need to use an Array Formula:
=SUM(IF((Data!A$1:A$1000=A13)*(Month(Data!C$1:C$1000) = 1),Data!B$1:B$1000))
Since it is an Array formula it needs to be confirmed with Ctrl-Shift-Enter when leaving edit mode. Then copied down.
I have some data in excel worksheet1 in this form:
person1 person2 person3 score
dave sarah jill 4
brandon hank 3
And in worksheet2 I have a column of people listed alphabetically, like this:
person score
alex
brandon
dave
hank
jill
sarah
I'd like to obtain each person's score from worksheet1 (with blanks for those who are absent):
person score
alex
brandon 3
dave 4
hank 3
jill 4
sarah 4
I've looked into functions like find, match, lookup, vlookup, but it seems like I will need something more complicated.
Assuming:
Each person can only ever occur once in the source data
The source data occupies the range A1:D3 (with headers in row 1)
The first person's name for which you wish to return a result is in G2
then this formula in H2:
=IF(COUNTIF($A$2:$C$3,G2),INDEX($D$2:$D$3,SUMPRODUCT(($A$2:$C$3=G2)*(ROW($A$2:$C$3)-MIN(ROW($A$2:$C$3))+1))),"")
Copy down to give equivalent results for names in H3, H4, etc.
Regards