Column to row formula in Sheets [duplicate] - google-sheets

The Google Sheets formula below is located in column A1 of my Google Sheet. This formula creates data in column A & B. I need to transpose this data into 1 row
=GOOGLEFINANCE(A2,"price",TODAY()-30,TODAY())
=TRANSPOSE(GOOGLEFINANCE(A2,"price",TODAY()-30,TODAY()))
The transpose formula successfully transposes the data in the 2 columns to 2 rows, as it should. My question is, will there be a way to transpose two columns of data into 1 single row - I have searched around for a solution for Google Sheets without any Luck.

you can use famous "double query smush" like:
=QUERY(TRANSPOSE(QUERY(TRANSPOSE(GOOGLEFINANCE(A2, "price", TODAY()-30, TODAY())),,999^99)),,999^99)

Related

Arrayformula not populating all other rows when using index+match

Sample data: https://docs.google.com/spreadsheets/d/10H7hToEek7XxXpPiAtlj6n58db_83Njdaxxspk4pIO8/edit?usp=sharing
Im trying to populate the 1st column of sheet 1 based on the data on sheet 2. VLOOKUP wouldnt work because im comparing the 2nd column of sheet 1 to the 2nd column of sheet 2 and vlookup will only allow it if im comparing to the 1st column of sheet 2. I tried index+match and it worked for 1 row but when I try to use arrayformula to populate all rows, it never runs for all the other rows.
Here is the index+match formula im using: INDEX(Sheet2!A2:A,MATCH(B2:B,Sheet2!B2:B,0))
Here is the formula I use with arrayformula:
=ARRAYFORMULA(INDEX(Sheet2!A2:A,MATCH(B2:B,Sheet2!B2:B,0)))
How do I make this run for all rows and if this won't work is there a better way to go about this?
per slippy101: =ArrayFormula(VLOOKUP(FILTER(B2:B,B2:B<>""),{Sheet2!B:B,Sheet2!A:A},2))
per Dazrin: =ARRAYFORMULA(IF(B2:B="",,VLOOKUP(B2:B, {Sheet2!B2:B,Sheet2!A2:A}, 2, FALSE)))
Both formula works, the problem arises because INDEX doesn't work with ARRAYFORMULA pointed out by Dazrin as well.

Generate all possible combinations for 3 Columns in Google Sheets

I have a Google Spreadsheets with four columns.
I need to populate the Column D with all the possible combinations of the values in Columns A and C. Please take a look a the capture to see what I mean.
I found this following formula, but it use for 2 column.but i have 3 column.
i am using this code:
=ArrayFormula(transpose(split(concatenate(rept(A1:A&char(9),counta(B1:B))),char(9)))&" "&transpose(split(rept(concatenate(B1:B&char(9)),counta(A1:A)),char(9))))
use:
=INDEX(FLATTEN(FLATTEN(
FILTER(A2:A; A2:A<>"")&" "&TRANSPOSE(
FILTER(B2:B; B2:B<>"")))&" "&TRANSPOSE(
FILTER(C2:C; C2:C<>""))))
Answer:
You can pass this formula back into itself to get the same result for three columns.
Formula:
=ArrayFormula(transpose(split(concatenate(rept(A1:A&char(9),counta(ArrayFormula(transpose(split(concatenate(rept(B1:B&char(9),counta(C1:C))),char(9)))&" "&transpose(split(rept(concatenate(C1:C&char(9)),counta(B1:B)),char(9))))))),char(9)))&" "&transpose(split(rept(concatenate(ArrayFormula(transpose(split(concatenate(rept(B1:B&char(9),counta(C1:C))),char(9)))&" "&transpose(split(rept(concatenate(C1:C&char(9)),counta(B1:B)),char(9))))&char(9)),counta(A1:A)),char(9))))
This formula replaces the references to B1:B to a formula which transposes all combinations of column B and column C, and transposes all those combinations with those in column A.

How to make a dynamic import command from one sheet to another in google sheets

I want to build a tool that lets me insert a spreadsheet in a given format into sheet1. Then it takes some data and inserts it into a specified location in sheet2.
I am using functions in the following format at the moments:
=Sheet1!AI2
For every column, I need the data from all rows i.e sheet1 A1 to sheet2 B2, Sheets A2 to sheet B3 ...
There are hundreds of rows and I don't want to copy-paste it and manually change the row number.
Is there a way to do it like this:
=Sheet1!AI(rownumber-1)
That way it would work for all rows.
Thanks for taking the time and reading this!
Try putting this in Sheet2!B2
=ARRAYFORMULA(Sheet1!AI:AI)
or this (it will give you the same result):
=INDEX(Sheet1!AI:AI)
Be sure that Sheet2 has at leas one more row than Sheet1. Google Sheets will automatically add 500 new rows, but if the numbers of rows in those sheets are codependent than rows will be added in a loop up until the limit.

Hihglight duplicate cells from two different sheets in Google Sheets

I am trying to highlight duplicate cells of Column A in sheet 1 by matching Column A in sheet 2. I used this formula in conditional formatting in sheet 1.
=countif(INDIRECT("2!A:A"),A1)>1
But it not working.
In sheet 1 Column A has these items
In sheet 2 Column A has these items
Here is the formula
Here is the google sheet
I check other links, but couldn't complete the task. So I am posting a new post.
your formula should be:
=COUNTIF(INDIRECT("2!A:A"),A1)>0

How to use Sumif using range from a complete different Googlesheet/doc

I know how sumif works when I need to access it within the same Google "workbook" (using the analogy from excel). By workbook I mean a collection of sheets, not sure whether there is a different way to refer to Google workbook.
For example in the sheet (Example 3): https://docs.google.com/spreadsheets/d/1Dm-N-1X38zHartE3JbPUtWDnYwEpkGHl6v06huvjSa8/edit#gid=0
I have Sheet2, with column A contain strings and column B containing numerical value. On sheet 1, I have a sumif function which can be query data stored in Sheet2, and sum the cells which match A1 in Sheet1.
The problem starts happening when I try to refer to ranges in a completely different workbook, which is shown below.
I am trying to do a sumif over 2 ranges from a different "workbook". The data is stored here (Example 2): https://docs.google.com/spreadsheets/d/1P5Inf09fLSRmsGbG7LwlE4V-r7DzqY0SB5tJuMKMZH0/edit#gid=0
The Sumif function is in Cell B1 of the following sheet (Example 1):https://docs.google.com/spreadsheets/d/1AitilELd6w7Dbv9d-mKhBYGTBaO6DdkU29Y5mofX2TI/edit#gid=0.
From my understanding importrange is typically used to refer to ranges in completely different workbooks, as a result I use importrange as the first and last arguments in the sumif function in the Sheet Example 1.
What am I doing wrong? Why is this not working?
Can anybody help?
Thanks a lot
See if this query does what you want:
=SUM(query( QUERY( Importrange("1P5Inf09fLSRmsGbG7LwlE4V-r7DzqY0SB5tJuMKMZH0","Sheet1!A1:B10") ) , "select Col2 where Col1 contains '"&A1&"'" ) )

Resources