I have values in column A, B and C for Google Spreadsheet:
A contains the results of each match (1X2)
B is what person B guessed that match
C is what person C guessed
Players can for each match guess 1 (home win), x (equal), 2 (away win) or a combination of them, like x2.
How can I compare the player's guesses (column B and C) with the match result (column A) and get the number of correct answers/matches?
Example:
Person B scores three points, because he guessed three matches correctly (not the second match though).
A B C
1 1x x2
x 1 x
2 2 1x
x 1x 2
CORRECT: 3 1
Add 2 columns D and E, than represent either a 0 or 1, then sum columns D & E. You would then put:
D2=IF(A2=B2,1,0)
E2=IF(A2=C2,1,0)
Then just copy paste formulas - since you aren't using absolute $ syntax for rows 3,4,5 etc.
Then just have D1=SUM(D2:D99) E1=SUM(E2:E99) - or something to that effect depending on number of rows.
Related
I have a table where I have many rows with their ids in groups of 2, and another column with one value associated that can be there ("X" value) or not:
ID
Flag_value
A
X
A
B
X
B
C
C
X
D
X
D
X
What I want to do is to check if there are any cases where the X value is associated to the same ID twice. In this case, this only happens for D (both of the ids have an "X"), but not for A,B or C. Having a lot of rows, is there a way of doing this with a formula? Many thanks in advance!
You may try:
=unique(filter(A2:A;map(A2:A;lambda(z;countifs(B2:B;"X";A2:A;z)))>1))
I am trying to determine how often values appear in a row based on the lead value of the row. Essentially, if "A" is the first value of the row, what percentage of those "A" rows contain the value "B" in the subsequent columns, what percentage contain "C" in subsequent columns, etc.
Below is an example table with the leads and their partners
Lead
Partner 1
Partner 2
A
B
C
A
C
E
B
A
E
C
B
A
A
D
B
B
C
E
A
B
D
B
E
D
C
D
B
A
E
C
I want to output a table which stays what percentages of times values B-E appear for rows which start with A. In the example above, A is the lead 5 times, and B appears in those A rows 3 times, so the value is 60%
A Partners:
Value
%
B
60%
C
60%
D
40%
E
40%
Partners will always be unique, i.e. the same value wont appear in both columns 2 and 3 (e.g. no "BEE"). It doesn't matter which column the partner appears in (2 or 3), it only matters if they appear in either column after where A is the lead.
I plan to have multiple "Partner tables" like the solution above, so I can also see how many times A&C-E appear in B-led rows, etc. But once I know how to make one table I can then make the others.
I tried a combination of IF and COUNTIF formulas, basically trying to say
If A2 contains A, then count the number of times B appears in the subsequent columns and divide it by the number of times A is in the lead.
=If((A2="A"),((COUNTIF(B2:C11,"B")/COUNTIF(A2:A11,"A")),0)
This of course results in skewed results because it counts how many times B appears in all rows, not just the ones which are lead by A. I'm having trouble limiting the count of Bs to only A rows.
Thank you!
You can set this formula:
=COUNTIF(FILTER(B:C,A:A = $F$1),F2)/COUNTA(FILTER(A:A,A:A = $F$1))
Or with BYROW for the four (or all you need) rows:
=BYROW(F2:F5,LAMBDA(each,COUNTIF(FILTER(B:C,A:A = $F$1),each)/COUNTA(FILTER(A:A,A:A = $F$1))))
Pl. refer the Sheet shared below -
https://docs.google.com/spreadsheets/d/1r0_oHLTcT9tmTJPgKVgkGwGWhooBM8uluwmWcC92eOk/edit?usp=sharing
Rank for diff. factors is calculated in Rank Sheet in Table A. Rank!ColL calculates combine score (D+ G + J).
PF Sheet Range - Z:AE have Step wise calculation and results expected.
1 - Objective is to get results of used Query(Rank!C8:L220,"Select C,L where D > F12 & L > 0.5 order by L desc",1) (ref. cell PF Sheet!AE17).
Query is referencing RANK Sheet's Cols.
2 - Possibility of merging Combine Score calculation as base data in Query.
Do revert is more clarity is reqd.
I reviewed the Sheet, and I can make some suggestions.
Since you are calling 2 columns with the Query, add 1 column to the right of AE, and that one will be the new AF.
After that, modify the formula from:
=query(Rank!C8:L220,"Select C,L where D > 0.25 & L > 0.5 order by L desc",1)
to:
=query(Rank!C8:L220,"Select C,L where D > 0.25 and L > 0.5 order by L desc",1)
The reason it was not working is the use of & instead of and as mentioned here.
To make reference to a specific Cell instead of a value. You can use "&F12&", Like this:
Reference
QUERY function
I have a google sheet that I am using to try and calculate leveling and experience points. Column A has the level and Column B has the exp needed to reach the next level. i.e. To get to Level 3 you need 600 exp.
A B
1 200
2 400
3 600
...
99 19800
In column I2 I have an integer for an amount of exp (e.g. 2000), in column J2 I want to figure out what level someone would be at if they started from 0.
Put this in column J and ddrag down as required. Rounddown(I2,-2) rounds I2 down to the nearest 100. Index match finds a match in column B and returns the value in column A of the matched row.
=index(A2:A100,match(ROUNDDOWN(I2,-2),B2:B100,0))
Using a helper column (for example Z): put =sum(B$1:B1) in cell Z1 and drag down. This will compute the sums required for each level. In J2, use the formula
=vlookup(I2, {B:B, Z:Z}, 2) + 1
which looks up I2 in column B, and returns the nearest match that is less than or equal to the search key. It adds 1 to find the level that would be reached, because your table has this kind of an offset to you: the entry against level N is about achieving level N+1.
You may want to put 0 0 on top of the table, to correctly handle the amounts under 200. Or treat them with a separate if condition.
Using algebra
In your specific scenario, the point amount required for level N can be computed as
200*(1+2+3+...+N-1) = 200*(N-1)*N/2 = 100*(N-1/2)^2 - 25
So, given x amount of points, we can find N directly with algebra:
N = floor(sqrt((x+25)/100)+1/2)
which means that the formula
=floor(sqrt((I2 + 25) / 100) + 1/2)
will have the desired effect in cell J2, without the need for an extra column and vlookup.
However, the second approach only works for this specific point values.
Given a spreadsheet with two columns, say A and B, each containing n values under it, all text; is there a formula that allows me to fill just one cell containing the amount of equal values in columns A and B?
Example:
A B
-----
1 M M
2 L M
3 L L
4 M M
5 M L
-----
3
Since columns A and B both contain an M in rows 1 and 4, and an L in row 3, the result is (i.e. 2+1).
A simple solution is to use QUERY function in google spreadsheet:
=SUM(QUERY(A1:B5, "Select 1 where A = B"))
Or using SUMPRODUCT:
=ARRAYFORMULA(SUM(((A:A)=(B:B)) * (1) ))
One of possible solution will be to add the following formula in column C: =N(EXACT(A1,B1)),
copy it throughout the column down to the last row and then sum up the column C values using =SUM(C1:C5).
Here we go:
=IF(EQ(LEFT(A0, 1), "A"),
SUM(ARRAYFORMULA(N(EXACT(TRANSPOSE(A1:A5), TRANSPOSE(B1:B5))))),
"")
Reading: if the value in row 0 (it doesn't exist, but my example above does ;) ) is equal to the text "A", take the sum of an array N, otherwise put in an empty string. ("")
Array N is build by taking the transpose of columns A and B. (Turning them, so they look like a row) and comparing the values. (Burnash gave me the options "N" and "EXACT") The formula N transforms this into a 1 or 0.
Copy paste the formula in an entire row and what do you know... It worked! That was hellish for something so trivial.
Thanks anyway.