Multiple summations in Google Sheets - google-sheets

I'm trying to make a system to calculate the Multivariate Hypergeometric Distribution in card games. The equation appear like this:
Is it possible to use Google Sheets to solve this, given that F, E and P are variables which will be solved through multiple steps (essentially finding P first, then E and finally F) ?

There's a built in funtion for this called HYPGEOMDIST.
You can look up this video too if you don't trust the formula

Related

How to sum multiple columns using a single formula in Google Sheets?

The data that i have is in a 2D fashion
I want the output in this type of schema using a Single Formula!
I've tried PIVOT and SUMIF,SUMIFS,QUERY functions. But, Alas unable to figure out the same. Can anyone please help me with this
You can use SUMPRODUCT for this task.
Formula B12 dragged right and down:
=SUMPRODUCT($B$5:$I$8*($A$5:$A$8=$A12)*($B$3:$I$3=B$11))
Result:
Pay attention at all those $ when adapting to your ranges.
you can also try this single formula to create the summary table.
=LAMBDA(x,y,{{"",y};x,MAKEARRAY(COUNTA(x),COUNTA(y),LAMBDA(r,c,SUM(FILTER(FILTER(B3:I,B1:I1=INDEX(y,,c)),A3:A=INDEX(x,r)))))})(FILTER(A3:A,A3:A<>""),UNIQUE(FILTER(B1:I1,B1:I1<>""),1))

google sheets: extract all decimals from a single row and find the average

I have a google sheet( link: https://docs.google.com/spreadsheets/d/1eilz0uOhAnXkc7dpvSktcXv1-S7BWRGw3MZj9kOZGoI/edit?usp=sharing) I need help with. I want to be able to put the average of the scores for topic 1 (eventually I will add more topics but am keeping it simple for the question) in B3. I need to be able to only take the decimal values of scores and count how many instances to get the average. I am new to google sheets. Any hints would be appreciated, thanks.
I have tried to use the average function but it seems to work for columns and doesn't account for only calculating based on integers.
Use average(filter()), like this:
=iferror( average( filter(C2:K2, C$1:K$1 = "scores") ) )

How to transpose out of order on Google Sheets

I'm working with a very large dataset and want to parse out useful information, but I cannot filter this information since some data points are so similar to others. Is it possible to transpose unique data points in Google Sheets
Say I have a list:
A
B
C
D
But I want to transpose only A, B, and D. Is there a way I can do that?
try:
=TRANSPOSE(UNIQUE(FILTER(A2:A; A2:A<>"C"; A2:A<>"")))
to exclude multiple values try:
=TRANSPOSE(UNIQUE(FILTER(A2:A; NOT(REGEXMATCH(A2:A; "C|B|X")); A2:A<>"")))
note that regex is case sensitive

Import multiple ranges from one Google Sheet into another

I am trying to import multiple sheets in one Google Sheet into another Google workbook. I can get ImportRange to work for one sheet but how do I use it for multiple sheets, or alternatively, how do I combine multiple ImportSheets in one column?
=unique(
importrange("https://docs.google.com/spreadsheets/d/...",
"'Kramerville KH'!d5:o1000"))
I want to be able to add another range to that, e.g. 'Emalahleni KH'!d5: o1000.
Use formula:
={unique(importrange("link...","'Sheet1'!d5:o1000"));
unique(importrange("link...","'Sheet2'!d5:o1000"))}
The result is two imports one behind another, see more info here.
There's no better way to do this. Alternative is to combine formula as text and then convert string into furmula using script. See how in this question.
Although the existing answer has been accepted the question appears to require exclusion of duplicates not only from within each range but also across ranges:
=unique({unique(importrange(" l i n k ","'Kramerville KH'!d5:o1000"));unique(importrange(" l i n k ","'Emalahleni KH'!d5:o1000"))})

Google Spreadsheet Arrayformula for multiple columns conditions

I'm new on google spreadsheets, and I'm having this little problem:
I need to Sum values from column K (a project), for an specified person in cell B3, where the project belongs to the category RF or RM in column C, I've tried this but returns the sum of K like not conditions where applied...
=arrayformula(if(AND('SheetX'!I$3:I=B3;OR('SheetX'!C$3:C="RF";'SheetX'!C$3:C="RM"));sum('SheetX'!K$3:K);0))
Also
=arrayformula(Sum(if(AND('SheetX'!I$3:I=B3;OR('SheetX'!C$3:C="RF";'SheetX'!C$3:C="RM"));'SheetX'!K$3:K;0)))
Thanks to anyone who can help me with this simple issue.
Already fixed. According to this link "The OR function does not work in array expression (nor does the AND function; but the NOT function does work). The workaround is to use ADD instead of OR and MULTIPLY instead of AND instead; for practical reasons use the + operator associated with ADD and the * operator associated with MULTIPLY."
What I did was this:
=Sum(filter('SheetX'!K$3:K;'SheetX'!I$3:I=B3;('SheetX'!C$3:C="RF")+('SheetX'!C$3:C="RM")))
Thanks to this video that clear it up.

Resources