How would i go about counting the scores between C1 and C8 and entering the values into A2 and B2?
a1 = blue
b1 = red
a2 = team blue score
b2 = team red score
between c1 to c8 = winning team & score (NOTE: c1 = $a$1&" 1.25" )
c1 = blue 1.25
c2 = blue 2
c3 = red .5
c4 = draw
c5 = blue 1.5
c6 = blue 1.75
c7 = red 2
c8 = draw
So what I should get is:
A2 should = 6.5
B2 should = 2.5
You can get the total score of the blue team with
=sum(arrayformula(if(left(C1:C, 4)="blue", value(regexreplace(C1:C, "[^0-9.]", "")), 0)))
For the red team, use left(C1:C, 3)="red" in the formula.
The conversion from text to number happens in two steps: regexreplace removes all characters except . and 0-9; then value converts text to number.
It would be better to keep the winning team and their score in separate cells (team in column C, their score in column D), which would simplify the handling of this data: you'd only need =sumif(C1:C, "blue", D1:D).
Taking help of helper columns and without Array formula.These formula can adapt if you change team to Green or any other colour.
Formula in D1:(And Fill down)
=VALUE(RIGHT(C1,(LEN(C1)-LEN($A$1))))
Formula in E1:((And Fill down)
=LEFT(C1,(MIN(FIND({0,1,2,3,4,5,6,7,8,9},C1&"0123456789"))-2))
(And Fill down)
Formula in A2:
=SUMIF(E1:E9,"blue",D1:D9)
Formula in B2:
=SUMIF(E1:E9,"red",D1:D9)
Related
Set-up
I have 2 Google Sheets tabs; Vertical and Horizontal.
Data in Vertical is noted vertically, that is,
A1 = X
A2 = Y
A3 = Z
etc.
I want the data from Vertical horizontally in Horizontal, that is
A1 = Vertical!A1 = X
B1 = Vertical!A2 = Y
C1 = Vertical!A3 = X
etc.
Isssue
When I set A1 = Vertical!A1 and drag the field horizontally to fill B1, C1,... I get,
A1 = Vertical!A1 = X
B1 = Vertical!B1 = empty
C1 = Vertical!C1 = empty
etc.
that is, instead of incrementing the number, Sheets increments the letter.
Question
How do I get Sheets to increment the number instead of the letter?
Simply copy+paste special -> transpose doesn't work between 2 sheets, it seems.
Googling around I see a lot of fancy formulas that don't do what they say?
Tried:
https://stackoverflow.com/a/30003770/7326714
https://webapps.stackexchange.com/a/126830
https://webapps.stackexchange.com/a/126844
use this and drag to the right:
=INDIRECT("Vertical!A"&COLUMN(A1))
you can use TRANSPOSE
=TRANSPOSE(vertical!A:A)
Transpose auto fill the others cells so there is no need to drag
Transposing rows in alternate columns
Suppose I have a continuous row
A1 = 1 A2 = 2 A3 = 3 A4 = $
I need to transpose it to
B1 = 1 D1 = 2 F1 = 3 H1 = 4
Is it possible?
=TRANSPOSE({A1; ""; A2; ""; A3; ""; A4})
={A1, "", A2, "", A3, "", A4}
if you are not US localized use: ={A1\ ""\ A2\ ""\ A3\ ""\ A4}
Try:
=if(isodd(column()),"",OFFSET($A1,int(column()-2)/2,))
in B1 and copy across to the right (assuming LTR).
I have arrayformula in the first row of a column so my values and calculations can start in Row 2 and for all the column length.
I have this situation:
https://docs.google.com/spreadsheets/d/11oDra7Vja4-5C0Uix7JTgLLSMG3gPj-6fkajXlWqqQk/edit?usp=sharing
I need a simply arithmetic operation:
Subtract above value of the same column for every row.
I'm using:
=arrayformula(IF(row(A:A)=1; "What I have now"; IF(ISBLANK(A:A); ""; A1:A-A2:A)))
but as you see is wrong.
How to do that?
UPDATED QUESTION:
And then in the second sheet I need a SUM operation with some blank cells in column:
How to do that?
https://docs.google.com/spreadsheets/d/11oDra7Vja4-5C0Uix7JTgLLSMG3gPj-6fkajXlWqqQk/edit#gid=931743679
If you want to have the array formula ion the header this is a bit weird as you need to allow the formula to technically access row 0, we can do this by constructing ranges.
=ArrayFormula(IF(
--(ROW(A1:A) > 2) + -ISBLANK(A1:A) = 1;
{0; A1:A} - {0; A2:A; 0};
""))
--(ROW(A1:A) > 2) + -ISBLANK(A1:A) = 1 Checks if the row is populated and not one of the first two rows in a way that works nicely with array formulas
{0; A1:A} - {0; A2:A; 0} does the following:
0 Data 156 123 110 95 42
- - - - - - -
0 156 123 110 95 42 0
= = = = = = =
0 33 13 15 53 42 42
N N Y Y Y Y N <- Is shown
^ ^ ^
| | Because Row is blank
| |
Because row not > 2, thus it is never evalauated even though the second would cause an error
I think this is quite tricky. The problem is that in an array formula the number of cells in each array must match - you can't mix an array starting in row 1 with an array starting in row 2 if they go all the way to the bottom of the spreadsheet.
Here is one way of getting the result you want
=arrayformula({"What I need";"";offset($A$1,1,0,count(A:A)-1)-offset($A$1,2,0,count(A:A)-1)})
You will need to change the ; and , for your locale.
I have built up an array using the {} notation to define the elements. In my locale a ; means go to the next row, so I have defined the first two cells directly as strings. After that I've chosen to use Offset to get the range A2:A5 (1 row down from A1, 0 rows across and 4 cells high) and subtract the range A3:A6 (2 rows down from A1, 0 rows across and 4 cells high) it so that gives me the other 4 cells.
B1 "What I need"
B2 ""
B3 A3-A2=33
B4 A4-A3=13
B5 A5-A4=15
B6 A6-A5=53
but will need an IF statement adding if there are any blank cells between the numbers.
In the particular case of your updated question where there are fewer numbers in column D than column C, the formula would be
=arrayformula({"Special Case";"";offset($D$1,1,0,count(D:D))+offset($C$1,2,0,count(D:D))})
But in the general case of there being blank cells anywhere, you would have to test everything
=arrayformula({"General Case";"";if(offset($D$1,1,0,rows(C:C)-2)="","",if(offset($C$1,2,0,Rows(C:C)-2)="","",offset($D$1,1,0,rows(C:C)-2)+offset($C$1,2,0,Rows(C:C)-2)))})
I have a table of values, dates and categories:
5 1.09.2013 red
-7 2.09.2013 red
9 21.09.2013 red
-2 3.10.2013 red
11 28.09.2013 green
3 2.10.2013 green
8 16.10.2013 green
I calculate sum of values where category is green with:
=sum(filter(A:A;C:C="green"))
How to sum just values from October where category is green ?
The following formula can help:
=SUM(FILTER(A:A, C:C = "green", VALUE(REGEXREPLACE(B:B, "^\d+\.|\.\d+$", "")) >= 10))
UPDATE
Here a sample with the test data set.
I have this spreadsheet:
A B C D E
1 08/13/2013 02:10 4
2 08/13/2013 02:19 10 00:09:00 160
In D2, I have this formula : =if(B2="";"";to_date(concatenate(A2;" ";B2))-to_date(concatenate(A1;" ";B1)))
In E2 I have this formula : =if(D2="";"";(C2-C1)/D2)
But E2 outputs the wrong result, 160. I want it to be 40 (=10-4/0.15). 0.15 is the value in D2 converted to hours.
How can I do that?
Do not quite understand what you're trying to calculate, but with the information that explains, the following formula can help:
=IF(D2 = "", "", ROUND((C2-C1)/(D2*24), 0))