This question already has answers here:
ultimate short custom number formatting - K, M, B, T, etc., Q, D, Googol
(3 answers)
Closed 8 months ago.
In a Google sheet, I have a list of rows with a length attached to each:
Example 1 - 1h 30m
Using a formula, I need to convert "1h 30m" to a numerical value.
The longest duration I have in the sheet are 4 digit durations (ie 1000h 30m)
Does anyone know how to best do this?
Assuming the text string 1h 30m is in cell B2, use a regexreplace() formula in another cell, like this:
=to_date( value( regexreplace(B2, "(\d+)h (\d+)m", "$1:$2") ) )
Format the formula cell as Format > Number > Duration or a custom time format of your choosing.
See this answer for an explanation of how date and time values work in spreadsheets.
To learn the exact regular expression syntax used by Google Sheets, see RE2.
Related
This question already has answers here:
Repeat range dynamically
(2 answers)
Closed 15 days ago.
I have a column containing x rows of names and I want to be able to repeat those rows of names x times each in another row.
It should be possilbe to have at least 15 names and repeate it 900 times.
Here an example:
I tried this now for about 6 hour with arrayformula etc. and didn't find any working solution..
For example =TRANSPOSE(split(rept(join(";",A:A)&";",10),";")) would do the job, but the rept function is limited in characters, so it doesn't work for this case..
Are you able to do this?
You can try with REDUCE and SEQUENCE like this. It's wrapped in QUERY to exclude empty rows, so you can get your full column as input, despite its amount of elements:
=QUERY(REDUCE(,SEQUENCE(A1),LAMBDA(a,v,{a;B1:B})),"Where Col1 is not null")
use:
=INDEX(FLATTEN(TEXT(TRANSPOSE(A1:A4); FLATTEN(SPLIT(REPT("#×"; 5); "×")))))
This question already has answers here:
ultimate short custom number formatting - K, M, B, T, etc., Q, D, Googol
(3 answers)
Closed 7 months ago.
I currently have a sheet with numbers displayed in the "K,M,B" format (e.g: 1.2K, 5M, 1.3B).
And I am currently trying to make a function that converts this to the numerical values on a separate sheet.
For example, 1.2k would be displayed as 1200 and so on.
Currently I have:
=SUBSTITUTE(Shorts!B2,"K","")*1000
However, I would also like this SUBSTITUTE functions to handle the case for M (million) and B (billion) so I can drag the cell down the column.
But when I add more multiplications to the nested functions
=SUBSTITUTE(SUBSTITUTE(Shorts!B2,"K","")*1000,("M","")*1000000
it doesn't seem to work and I get a formula parse error.
Any guidance would be much appreciated.
try:
=INDEX(IF(REGEXMATCH(A1:A4&"", "M"),
REGEXEXTRACT(A1:A4, "\d+.\d+|\d+")*1000000,
IF(REGEXMATCH(A1:A4&"", "k"),
REGEXEXTRACT(A1:A4, "\d+.\d+|\d+")*1000,
IF(REGEXMATCH(A1:A4&"", "B"),
REGEXEXTRACT(A1:A4, "\d+.\d+|\d+")*1000000000, A1:A4))))
This question already has answers here:
ultimate short custom number formatting - K, M, B, T, etc., Q, D, Googol
(3 answers)
Closed 8 months ago.
I have a list of numeric duration values:
1:00:00
3:00:00
2:30:00
4:45:00
that I would like to convert into text string values in a certain format:
xxh yym (h=hours, m=minutes)
So the above should look like:
1h 00m
3h 00m
2h 30m
4h 45m
I need to solve this preferably with a formula so I can convert 8k rows.
What's the best way to go about this?
You can do this with an array formula and the TEXT() method:
=arrayformula(text(A1:A, "h\h mm\m"))
Just replace A1:A with the range of time values you would like to convert.
Please let me know if you have any issues
Well quick go at this:
But there are other ways.
This question already has answers here:
ultimate short custom number formatting - K, M, B, T, etc., Q, D, Googol
(3 answers)
Closed 1 year ago.
I found this online which formats thousands, millions, and billions
[<999950]0.0,"K";[<999950000]0.0,,"M";0.0,,,"B"
number format sheet
how would you format it so it's by millions, billions, and trillions
Link to sheet
this "internal" formatting is by default able to work with only 3 types of numbers:
positive (1, 2, 5, 10, ...)
zero (0)
negative (-3, -9, -7, ...)
this can be somehow tweaked to show custom formatting like K, B, M but you always got only 3 slots you can use, meaning that you can't have trillions as the 4th type/slot
[<999950000]0.0,"M";[<999950000000]0.0,,"B";0.0,,,"T"
This question already has answers here:
ArrayFormula of Average on Infinite Truly Dynamic Range in Google Sheets
(6 answers)
Closed 5 months ago.
So, right now im working on another spreadsheet project and this time i want to know how to use Average Formula with Array formula to make them automatically dragdown each time a new data entered.
Here is the picture from my spreadsheet. So i want to average them from Column CH to Column CL using average formula with arrayformula.
Example
I've tried all 'Averageif' or 'Average' and using arrayformula but it turns out '#DIV/0'
Can you guys please help me with it? Thankyou.
It's not going to work.
Average formula works on arrays so it won't change anything when you try nest it with arrayformula. For example. If you try to average 3 values from 3 columns, you could try: arrayformula(average(CH1:Ch,CI1:CI,CL1:CL)) but it will return the same result as average(CH1:Ch,CI1:CI,CL1:CL) - an average of all values from all 3 ranges.
I suggest workaround and make average manually (sum of elements divided by it's number):
=Arrayformula( (CH1:Ch + CI1:CI +CL1:CL)/3)
these days it can be done like:
=INDEX(IFERROR(1/(1/BYROW(OFFSET(CH2,,,
MAX((INDIRECT("CH2:"&ROWS(CH:CH))<>"")*ROW(CH2:CH)), 5),
LAMBDA(x, AVERAGE(x))))))
for more variations see: https://stackoverflow.com/a/65435321/5632629