Concatenate merged cells with Google Sheets - google-sheets

I have this situation on Google Sheets:
I want to concatenate (=A2&B2) with a merged cell, but only the first cell has a value. I want to get the values of the column "Expected results". How I can detect the first value of each work office in this example?

You can use INDEX/AGGREGATE:
=INDEX($A$1:$A$9,AGGREGATE(14,4,(ISBLANK($A$1:$A$9)=FALSE)*(ROW($A$1:$A$9)<=ROW())*ROW($A$1:$A$9),1)) & B2
Edit for google sheets:
=INDEX($A$1:$A$9,LARGE((ISBLANK($A$1:$A$9)=FALSE)*(ROW($A$1:$A$9)<=ROW())*ROW($A$1:$A$9),1)) & B2

When merging a cell, the content appears only as if it were if the first cell of that block. Hence, you need to only use that first value as your reference. For this you need to block the reference, and it would look like this:
=($A$1&B2)
You can check more information about that in this link.

Try this in D2:
=ARRAYFORMULA(IF(B2:B="",,VLOOKUP(ROW(A2:A),FILTER({ROW(A2:A),A2:A},A2:A<>""),2)&B2:B))

Related

Google Sheets formula to leave cell empty based on conditions

I'm having issues with this formula:
=ARRAYFORMULA("WORD"&" "&sheet1!$B$20&" "&'sheet2'!A2:A&" "&sheet1!$B$17&'sheet2'!B2:B)
What I want is to leave empty cell if there is no data available in sheet 2 and when the data is added in the sheet (sheet2) the formula auto populates the results in the third sheet, where the formula is placed.
Tried with If function, but I'm getting Errors.
Thanks in advance for the help.
=ARRAYFORMULA(IF('sheet2'!A2:A="","","WORD"&" "&sheet1!$B$20&" "&'sheet2'!A2:A&" "&sheet1!$B$17&'sheet2'!B2:B))

How to insert row with formula that links cell? Google Sheets API

The answer is next:
1) There is formula in Google Sheet cell "A11", for example "=F11+C11";
2) I append multiple data to this Google Sheet list with the help of
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdate
or https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append
3) I need to append the value for "A12" using its current position. It had to become "=F12+C12".
Or if I append data on top
(as described here - Google sheets API append method (last on top))
I need that formulas under my append changed to correct value. If current value of "A11" is "=F11+C11" then,
if I add 3 rows before this row, it becomes "A14" cell and it's value had to be changed to "=F14+C14"
Is there any way to realise both this scenarious directly in Google Sheets API request? May be there is some settings in Google Sheet that can help me (something like formating of cells/columns etc)?
UPD. For now it all works fine except of that incident when formula returns exception! My questions is not actual for now, but I still not understand in which cases formulas will change and in which they will not.
The answer is quiet simple!
I update cell 'A13' with formula '=B2+C2' and as cells 'B2' and 'C2' stay on their places after every changes my cell 'A13' still link cells 'B2' and 'C2'.
But if I will add row before 'B2' and/or 'C2' then formula will change and my cell 'A13' will link 'B3' and 'C3'.

Need a Google Spreed Sheet Formula

How do I copy data from one cell of a column to next cell of next column if the data is greater than 2 by using formula?
Now my file is like this:
I want to transfer the data from column B to column C, whose value > than 2.
So, the sheet will be like this:
Please help me to solve this... Thank You.
You can copy the values over if they are greater than or equal to five, but moving them is not something you can do with a custom function, you would need apps script running to do that for you.
Here is what you can do: =IF(B2 > 2, B2, "") , this will copy the value over if its > 2. Just drag this formula down the sheet.
I have also added basic conditional formatting to highlight it as red.
Example Sheet
try this formula:
=ArrayFormula(
{sheet1!A2:A,
if(sheet1!B2:B<=2,sheet1!B2:B,""),
if(sheet1!B2:B>2,sheet1!B2:B,"")})
use it in separate sheet to convert existing table(1) to result table(2) from yuor example.

Use cell reference inside google spreadsheet function

I am using Google Spreadsheet function.
This formula works fine.
=ImportXML("https://www.google.com/finance?q=SHA:000001", "//span[#class='pr']")
The string SHA:000001 is contained in cell B4. I would like to use cell reference. So, I changed to formula to
=ImportXML("https://www.google.com/finance?q=" + B4, "//span[#class='pr']")
Unfortunately, this did not work. The value returned is #VALUE!. How should the correct formula look like?
You need to use an ampersand not a plus sign:-
=ImportXML("https://www.google.com/finance?q="&B4, "//span[#class='pr']")

Use text from cell with IMPORTRANGE

I have two Google Sheets: the first contains data per week and the second gives an overview of that data. The sheets in the first are named by week. For example: Week 1, Week 2, Week 3, Week 4 ... The sheets in the second contain one cell which has the same text as the sheet names of the first document. This cell is A1.
Using the IMPORTRANGE function I want to show some data from the first (data) document in the second (overview) document. Currently the IMPORTRANGE formula looks like this:
=IMPORTRANGE("https://docs.google.com/...; "Week 1!C2:C5")
As you can see I have to change the sheet name I reference to manually. I want it to change automatically using the text in cell A1. So it should look like this:
=IMPORTRANGE("https://docs.google.com/...; "A1!C2:C5")
Is it possible to do it like this or do I need a script and how can I make it work?
Thank you for your tip about using ranges, I will use it in the future. You suggested the following formula:
=IMPORTRANGE("https://docs.google.com/...; A1)
It didn't work. I got it to work with the following formula:
=IMPORTRANGE("https://docs.google.com/..."; (A1&"!C2:C5"))
sure, just try it:
=IMPORTRANGE("https://docs.google.com/..., A1)
I also recommemnd you use named ranges (google it). this allows you to just type in "week1" into cell A1, instead of something like "Sheet3!A1:B343." Without named ranges any complex spreadsheet will turn your formulas into an indecipherable mess.

Resources