I am trying to create the following in Tableau (fake numbers):
Col 1 - Person A number of correct answers = 5 , total questions = 10, % correct = 50
Col 2 - Person B number of correct answers = 8, total questions = 8, % correct = 100
...
Col n - Person n number of correct answers = 9, total questions = 10, % correct = 90
Grand total - total correct answers for everyone, total questions for everyone, % correct
I would like for the grand total column to read 5+8+9 = 22, 10 + 8 + 10 = 28, 22/28 = 78.5%.
However, the % correct column for the grand total only has choices of average, min, max, or sum. % correct is a calculated field based on the other two fields. I want the calculated field to keep working even in the grand total column to give me 78.5%. Does anyone know how to get the answer I want of 78.5%?
You can duplicate whatever field is giving you the total correct answers and make the duplicated field a table calculation for percent of total. The Grand Total will include this column.
Related
Need help:
I have a number (let's say 550) and need to create a perfect distributed SEQUENCE of length N where SUM of numbers will give this number (550).
Something like: 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
The only input I have is the length of sequence and the final sum of it's numbers.
Thank you.
=INDEX(SEQUENCE(length;1;1)*2*sum/length/(length+1);;)
So here are some possible starting values (a) and increments (d) that satisfy the conditions where the number of terms n is 10 and the sum S is 550:
Using the formula
=MAKEARRAY(S/n,2,LAMBDA(r,c,if(c=1,r,2/(n-1)*(S/n-r))))
The formula is obtained by re-arranging the standard formula for an arithmetic progression to get d (the increment) in terms of a (the starting value, S (the sum) and n (the number of terms):
Here are the integer pairs using
=lambda(pairs,filter(pairs,index(pairs,,2)=int(index(pairs,,2))))(MAKEARRAY(S/n,2,LAMBDA(r,c,if(c=1,r,2/(n-1)*(S/n-r)))))
Here are the actual series using
=lambda(intpairs,makearray(rows(intpairs),n,lambda(r,c,index(intpairs,r,1)+(c-1)*index(intpairs,r,2))))(lambda(pairs,filter(pairs,index(pairs,,2)=int(index(pairs,,2))))(MAKEARRAY(S/n,2,LAMBDA(r,c,if(c=1,r,2/(n-1)*(S/n-r))))))
It can be verified that each series totals to 550.
Once you have the values of a and d, you can also use Sequence to generate the results:
=sequence(1,n,F10,G10)
if your issue is to divide value x into equal chunks y try:
=INDEX(SEQUENCE(B1, 1)*A1/B1)
or starting from 0:
=INDEX(SEQUENCE(B1, 1, 0)*A1/(B1-1))
I am trying to convert a duration to a number. I have a cell that lists total hours and total minutes from a Google Meet. I am trying to automatically convert that information to the total number of minutes expressed as a number.
Ex: Cell 1(1 hr 8 min) to Cell 2 (68)
The google meet data, with the total hour/ total minutes) will be automatically pasted in from the meet report.
Is this possible?
If you have the duration always expressed as X hr Y min,
UPDATED:
= ARRAYFORMULA(
IFNA(
IF(LEN(B2:B),
REGEXEXTRACT(B2:B, "\d+") * 60 + REGEXEXTRACT(B2:B, "\D+(.+)min"),
""),
REGEXEXTRACT(B2:B, "\d+")
)
)
This part extracts the number before the hr and we multiply it by 60
REGEXEXTRACT(B2:B, "\d+")*60
This part extracts the number between hr and min and we add it to the above result:
REGEXEXTRACT(B2:B, "\D+(.+)min")
To adapt the formula to your situation, please consider the following notes:
Durations in the example starts from B2
Total is retrieved in C2:C
Arrayformula is used: i.e. only one formula is used in C2, and no need to copy the formula down
Supposing your original string were in A2, and that no meeting ran more than 9 hr 59 min, you could use this simple approach:
=TIME(LEFT(A2,1),MID(A2,6,2),0)*24*60
ADDENDUM (after more information added by poster)
This will cover your newly given scenarios:
=TIME(IFERROR(REGEXEXTRACT(A2,"(\d+) hr"),0),REGEXEXTRACT(A2,"(\d+) min"),0)*24*60
I have a spreadsheet that works properly in Excel. However, when I import it to Google Sheets it gives me the #DIV/)! error. I am at a loss for how to fix this.
I am trying to rank the items based on the number in column P. I would like for the highest number in column P to be ranked 1, then 2, 3, etc. If two numbers in column P are the same I would like for them to both be ranked the same. However, I don't want the formula to then skip the next number in the ranking order. Also, I am not sure if it matters, but column P displays a number but is technically filled with a formula to obtain that number. Example:
Points column is populated using the following formula:
=SUM(H2,J2,L2,N2,O2)
Points Rank
5 3
3 4
8 1
3 4
6 2
2 5
=SUMPRODUCT((P2 < P$2:P$36)/COUNTIF(P$2:P$36,P$2:P$36))+1
Any ideas?
Add the opposite of the numerator to the denominator to ensure you never receive #DIV/0!.
=SUMPRODUCT((P2 < P$2:P$36)/(COUNTIF(P$2:P$36,P$2:P$36)+(P2 >= P$2:P$36)))+1
When (P2 < P$2:P$36) is false, the numerator will be zero so it doesn't matter what the denominator is as long as it isn't zero.
The Set Up:
I have a single column, with three cells.
These cells are drop-down lists. (177 options in the drop-down).
Trying to figure out:
I want to automate matching (if two or all three items match in the same column, to each other) and return a specific number.
Column that needs to match. Output in other column.
So a normal "countif" isn't going to work, as I would need to specify what is being counted. I need it to "see" that there is a match and spit out a specific number.
Sample in works.
if A1 = A2 = A3 = 30 points
if A1 = A2 = 20 points
if A1 = A3 = 20 points
if A2 = A3 = 20 points
if non are same = 10 points
=IF(AND(A1=A2, A2=A3), 30,
IF(OR(A1=A2, A1=A3, A2=A3), 20, 10))
Cries out for COUNTUNIQUE. Assuming relevant dropdowns are in B10:B12 :
=countunique(B10:B12)
and if 1, 2, and 3 are not suitable for the "specific number" then these can be mapped to suitable alternatives (I chose 7 for all the same, 0 if all different, and 3 otherwise):
=choose(countunique(B10:B12),7,3,0)
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.