Trying to calculate a Win/Loss ratio based on specific cells - google-sheets

I'm trying to have a W:L ratio calculated into my Google sheet based on specific cells.
B2:M2 are manually updated to be either W or L
I would like O1 and P1 to reflect. So if there are 7 W's and 5 L's between B2:M2, I would like cell O1 to show (7)W and have cell P1 show (5)L
Any help would be appreciated. I'm relatively noobish to Google sheets
Image below!
B2:M2 are manually updated to be either W or L

W → ="("&COUNTIF(B2:M2,"=W")&") W"
L → ="("&COUNTIF(B2:M2,"=L")&") L"
To calculate just the number of W or L, just remove the text extras, it would look like this:
W → =COUNTIF(B2:M2,"=W")
L → =COUNTIF(B2:M2,"=L")

Related

How to make scatter plot in google sheets using 2 columns as X and Y values and the 3rd columns to get color of that point?

I have 3 columns in a google spreadsheet
Runs Balls Result
24 24 W
50 20 W
10 5 L
12 10 L
5 2 L
Now I want a scatter plot to be made, such that Runs and Balls are the X and Y axes, and the color of the point is determined by the values in the column Result.
How do I achieve this?
You could separate your second column (y-value, "Balls") into two separate columns, depending on if the Result is W or L. In other words, make a chart based on three columns instead of two. This way, two different colors will be assigned automatically when the chart is generated. (Later, you can change these colors by double-clicking on the chart to get to Chart Editor -> Customize -> Series -> Format -> Color).
There seem to be no good solutions here. Answer from Monaco works but is inconvenient in cases. I settled for adding the third column as a label for the second one.

Adding the first digit(s) of a cell ending with specific letter

I have a sheet that has blocks of cells. I add them for a total if they don't contain any letter. Letters signify a specific variable or signifier code for tracking. I also want to add the cell value when a cell has an ending code letter. I've tried SUMIF, Substitute, SumProduct and a few others.
For a while I've used the following which worked till the S value changed to another number than "8" which then gave the wrong sum from the range.
=if(countif(D64:Q64,"*S")=0,"",((countif(D64:Q64,"*S"))*8))
In the cell range I have 5 variable groups ending in a letter (A, H, S, C and R) and one group not ending in any letter.
The formula I use to add the cells not containing a letter but have a value is this
=IF(SUM(AA64,(SUMIF(D65:Q65,"<>")),-(COUNTIF(D65:Q65,">=0")*8))>24,24,(SUM(AA64,(SUMIF(D65:Q65,"<>")),-(COUNTIF(D65:Q65,">=0")*8))))
which adds the table data plus the previous lines table data but does not exceed 24.
H is a set value of 6 and doesn't change.
Does anyone know how to add the value of the cells that contain a specific letter?
N (number)
A
S
C
R
H
8.5
H
8A
2S
9
3C
0.5R
17.5
8
2
3
0.5
6
I'd prefer it be a formula usable in Google Sheets because that is where this data is.
Solution:
You can use this formula below column "N" then drag right until below column "H".
=SWITCH(H$1,"N",SUM($A2:$G2),"H",6,SUM(IFERROR(ARRAYFORMULA(VALUE(LEFT($A2:$G2,FIND(H$1,$A2:$G2)-1))),0)))
This is a combination of three formulas:
If the row above is N, sum A2 to G2. This will ignore all the strings.
If the row above is H, output 6.
Else, get the number to the left of the defined suffix, set all others to 0, and get the sum.
Output:
References:
Extract number from string in Google Sheets
An alternative could be to use
=SUMPRODUCT(A3:G3, isnumber(A3:G3))
to compute the sum of the cells with numbers only, and to use
=sum(filter(substitute($A$3:$G$3, I$2,)+0, regexmatch($A$3:$G$3, I$2)))
under the 'A' and drag to the right
Examples

google sheet change background based on text to multiple columns

I learned to change background color base on cell text by column, but I need to do it column by column, does google sheets support apply a formula for multiple columns?
For example:
A B C D
1 Name v1 v2 v3
2 Apple Y Y Y
3 Orange N N Y
I can use below formula for one column:
=REGEXMATCH(B2:D3,"Y")
I try to change it to a region as below but doesn't work:
=REGEXMATCH(B2:D7,"Y")
First select range B2:D7.
Then, use this formula in Conditional formatting custom formula
=ArrayFormula(REGEXMATCH(B2:D7,"Y"))
OR put Y in text is exactly

Is it possible to transform cell L2 in this google sheet into an array formula?

=IF(ISBLANK(A2),"",MAX(ARRAYFORMULA(EQ($I2:$I,$I2)*$C2:C)))
https://docs.google.com/spreadsheets/d/1oAUNg9Kq119T4io4oHTGbvp1Klsd2SuGu3G1fs3bnhM/edit#gid=0
screenshot
You can do this if you want it to go to the other cells:
=ARRAYFORMULA(IF(ISBLANK(A2:A),"",MAX(EQ($I2:$I,$I2:I)*$C2:C)))
Anyway, I would like to say that when in your original formula are doing EQ($I2:$I,$I2), it will return always TRUE as you are searching in a place where the cell you are looking for is there.
This will make the whole formula only return the latest value of all of the values in the column C. Your implementation will always return the value in the corresponding C column: L2 = C2, L3 = C3 and so on. So if you want your formula to match the rows in the column C, you can set this:
=ARRAYFORMULA(IF(ISBLANK(A2:A),"",$C2:C))

COUNTIF with absolute column, relative row in Google Sheets

I have this table and I want B1 and B2 to display the sum where D1, F1 and H1, and D2, F2 and H2 are bigger than 0, respectively. I will be inserting two columns to the left of C on a regular basis, and I don't want the column references in the formula to be updated when the columns are shifted, but if B2 becomes B3 when a row is added above it, I will need the formula to be updated for the row and check the values in D3, F3 and H3, or if I add rows below it, I want to be able to drag down and get the formula copied with incremental row values. I tried INDIRECT with and without &CELL("address", E2) but I couldn't get it to work as I wanted it.
A B (Sum) C D E F G H
1 Josh 3 Some number 6 Some number 4 Some number 3
2 Fiona 2 Some number 1 Some number 0 Some number 4
You can use OFFSET to get absolute column references, and COUNTIF to count if each referenced cell is bigger than 0:
=COUNTIF(OFFSET(B1,0,2),">0")+COUNTIF(OFFSET(B1,0,4),">0")+COUNTIF(OFFSET(B1,0,6),">0")
Not perfect, but try =SUM(OFFSET(B2,0,1,1,500)). That way you refer to the cell itself so whenever you add columns it's not affected. I used 500 arbitrarily since it's simple. Adjust as needed.

Resources