I have an Excel file which contains two columns for hours and minutes, like:
hr |min
---+---
7 | 2
10 | 16
9 | 12
I would like it to present in additional column as
07:02
10:16
09:12
How to do that in Excel 2010?
A B C
1 hr min hr:min
2 1 2
3 2 12
4 3 15
5 10 45
click on the cell C2 and put follwing formula at the formula bar and drag it for other rows.
=CONCATENATE(CONCATENATE(IF(A2 >9, A2, CONCATENATE("0",A2)),":"),CONCATENATE(IF(B2 >9, B2, CONCATENATE("0",B2))))
To get Sum of the of hr:min column
click on the cell where you want to display total and put follwing formula at the formula bar.
=CONCATENATE(CONCATENATE((SUM(A2:A5) + INT(SUM(B2:B5)/60)),":"),MOD(SUM(B2:B5),60))
Here you go
=SUM(TIME(A2,B2,0))
Related
I'm trying to write a formula in Google Sheets which can first locate the row of a specific value. Then index to the value contained on that row a few columns over.
Let's assume the following
A B C
1 12 80
2 43 35
3 64 15
4 13 56
5 44 93
6 86 48
7 14 31
8 41 3
9 63 56
10 11 46
Values in column B and C have a correlated relationship. I need to first locate a specific value in column B than find it's corresponding value on the same row in column C.
For the sake of example, let's assume I'm trying to locate the row containing the value 41 in column B. And then would like to return the corresponding value in column C, which in this case would be 3.
The reason why I need a formula like this is because the data I'm using is highly variable and large. Over 4000 rows. It is unknown what rows the values to be found sit on.
You may try either:
=filter(C:C,B:B=D2)
OR
=xlookup(D2,B:B,C:C,)
filter() will output all instances of rows(column C) which has 41 in column B while xlookup will pick just the first match of 41 within the column
I have a table in my Google Spreadsheet that looks like this :
Row
(A) Some day
(B) Some data
1
day 1
5
2
day 2
10
3
total
4
day 1
8
5
day 2
7
6
day 3
9
7
total
Where I can have multiple "day rows", but I don't know how many. It can be only 1 like it can be 20 "day rows". And I want the "total row" to automatically do a SUM of the "day rows" above.
Result expected :
Row
(A) Some day
(B) Some data
1
day 1
5
2
day 2
10
3
total
15
4
day 1
8
5
day 2
7
6
day 3
9
7
total
24
Where B3 is equal to SUM(B1:B2) and B7 is equal to SUM(B4:B6)
I am trying to do that without the App Script, just using Spreadsheet native functions.
I think I should be using the SUM function or the Query function, but I don't know how to dynamically get the right range. Do you have any idea how to do that ?
Thank you
In your example, column B would be a mixture of constants and formulas. That would require a script to deposit the formulas. However with an extra column, you can avoid scripts. In C2 enter:
=if(A2<>"Total","",sum($B$1:$B1)-sum($C$1:C1))
and copy downwards:
Basically we add column B and subtract any previous Totals in column C.
Another approach is to place the following single array formula in C1:
=ArrayFormula(IF(A:A="",, SUMIF(IF(ROW(A:A),ROW(A:A)), "<="&ROW(A:A),B:B) - SUMIF(IF(ROW(A:A), ROW(A:A)),"<="& VLOOKUP(ROW(A:A)-1, FILTER(ROW(A:A), A:A="total"), 1, TRUE), B:B)))
If you only want to see the values for the "total" rows, change the opening
IF(A:A=""
to
IF(A:A<>"total"
The short version of how it works is that a sum is made of all values up to the current row in B:B, and from that is subtracted any values up to the last listing of the word "total" in A:A.
paste in each cell in B column where A column = total
=INDEX(SUM(IFERROR(1*INDIRECT(ADDRESS(MATCH(INDEX(
COUNTIFS({"total";A:A}, {"total";A:A}, {"total";A:A}, "=total",
{ROW(A:A);ROW()}, "<="&{ROW(A:A);ROW()})-1, ROW()+1, 1),
COUNTIFS({"total";A:A}, {"total";A:A}, {"total";A:A}, "=total",
{ROW(A:A);ROW()}, "<="&{ROW(A:A);ROW()}), 0), 2)&":"&
ADDRESS(ROW()-1, 2)), 0)))
In a worksheet of multiple sheets, I have Sheet1, e.g. with the following: (these rows will be less or more and are manually entered)
Sheet1
A B C
1 APPLE ORANGE LEMON
2 bravo chair mars
3 charlie table jupiter
4 alpha box venus
5 delta saturn
6 foxtrot
I would like some help in constructing Sheet2 via formulas so that it rearranges data from Sheet1 as follows
Sheet2 (Desired result)
A B
1 APPLE
2 bravo
3 charlie
4 alpha
5 delta
6 foxtrot
7
8 ORANGE
9 chair
10 table
11 box
12
13 LEMON
14 mars
15 jupiter
16 venus
17 saturn
It probably needs some combination of QUERY() ARRAYFORMULA(), TRANSPOSE() and/or INDEX() but I need some help with getting started and having them into lesser columns (and more rows.) as shown. Please note that Sheet1's data will keep changing in number of rows (or columns) so Sheet2 needs to adapt to that.
Thank you.
You can try following formula:
=ArrayFormula(
{FILTER(
FLATTEN(TRANSPOSE(IF(ROW(A:F)=1;A:F;"")));
FLATTEN(TRANSPOSE(A:F))<>"")
\FILTER(
FLATTEN(TRANSPOSE(IF(ROW(A:F)<>1;A:F;"")));
FLATTEN(TRANSPOSE(A:F))<>"")}
)
if you use semicolon as function argument separator.
If you use comma, change to
=ArrayFormula(
{FILTER(
FLATTEN(TRANSPOSE(IF(ROW(A:F)=1,A:F,""))),
FLATTEN(TRANSPOSE(A:F))<>"")
,FILTER(
FLATTEN(TRANSPOSE(IF(ROW(A:F)<>1,A:F,""))),
FLATTEN(TRANSPOSE(A:F))<>"")}
)
The formula will run faster if you specify a row constraint.
Is it possible to use QUERY() to get the sums of rows into cells?
For example, I have
a b c d
1 2 3 2
3 4 2 6
4 6 3 3
and I want to use QUERY() to get:
8
15
16
Thanks!
This will sum the numerical values in the rows. It does not get the 'a':
=transpose(query(transpose(QUERY(A:D,"select * offset 1",0)),"select sum(Col1),sum(Col2),sum(Col3) label sum(Col1)'', sum(Col2)'',sum(Col3)''"))
Returns:
8
15
16
Here is my test spreadsheet:
https://docs.google.com/spreadsheets/d/1At60xluiG_JvNh9onPgxGt9TeWMJ8l00o2pwUxWbnBM/edit?usp=sharing
I've made an excel document from MS2013 (xlsx) that computes all numbers above it, because i want it to dynamically compute and adjust its own formula as i add more rows above it. But when i import this on google spreadsheets, the formula doesn't work anymore. here is the sample and formula
A B C D
1 3 3 2 2
2 4 3 4 5
3 5 6 4 3
4
5 12 12 10 10
the formula for A5 is =SUM(A1:OFFSET(A5,-1,0))
when i add 1 more row above A5 the formula adjusts accordingly to the formula's current position. What's the correct formula for google spreadsheet?
I propose you this formula (it's certainly not the better solution, nevertheless it's a solution):
=sum(indirect("A1:"&ADDRESS(ROW()-1;COLUMN())))
You can use this in your example:
=SUM(A1:A4)
If you start adding extra rows, then they will be automatically accounted for.