Need a Google Spreed Sheet Formula - google-sheets

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.

Related

Adding values based on other values but SUMIF is quite right

Here is a link to my spreadsheet. Essentially what I am looking for is if the task matches then I want to also be able to give a Tech level then from there add up the values. I put a note in the sheet but basically if I give a task value and a tech level I want the corresponding value but whenever I try to do multicolumn adding in my sumif it just gives me the value from the first column.
An example of the formula I want is something like =SUMIF(Name, Name2 and Rank, Add Values).
try:
=INDEX(IFNA(VLOOKUP(K3:K&"♥"&L3:L, SPLIT(FLATTEN(
IF(B2:D="",,A2:A&"♥"&B1:D1&"×"&B2:D)), "×"), 2, 0)))
I think what you are looking for can be done by using a Index-Match function.
e.g. If you paste the following formula in an empty cell somewhere in the sheet,
=INDEX($A$1:$D$8, MATCH("Task 1",$A$1:$A$8,0),MATCH("Tech 2",$A$1:$D$1,0))
it gives you 20 corresponding to Task 1 and Tech 2.
If you paste the following in an empty cell somewhere in sheet,
=INDEX($A$1:$D$8, MATCH("Task 7",$A$1:$A$8,0),MATCH("Tech 3",$A$1:$D$1,0))
it gives you 36 corresponding to Task 7 and Tech 3.

Can you copy down an IMPORTXML function using an ArrayFormula?

I'm trying to get the below formula to copy down column D (in red) and have the same results as column E (in green)
={"Query in H1";ARRAYFORMULA(IF(B2:B<>"",(IF(ISNUMBER(SEARCH(B3:B,IMPORTXML(A2:A,"//h1"))),"Yes","No"))))}
This formula collects the H1 (xpath) via the IMPORTXML function of the URL (column A) and checks to see if the keyword (column B) is included. If it is "Yes" if not "No"
See Google Sheet for reference:
https://docs.google.com/spreadsheets/d/1iHkU-rNtNhoOKvW_CWY7WU5OLsMFVqEFNRZlx_R-7RY/edit#gid=1497887942
Your formula just needs a few modifications:
Remove the header text and modify the SEARCH parameters to B2:B such that the formula looks like this:
=ARRAYFORMULA(IF(B2:B<>"",(IF(ISNUMBER(SEARCH(B2:B,IMPORTXML(A2:A,"//h1"))),"Yes","No"))))
Place the formula in the D2 cell.
After all the changes, this is how your sheet will look like:
I have also taken the opportunity to create a copy of the sheet named Answer with all the modifications.
As far as I know, we can not use ImportXML with ArrayFormula, the result after run formular will not correct. Even you see the result run down from the top to the last column, but the result will be wrong.
You can see an example in the screenshot below, with the same URL, the results in Column F and I are different from each other.

Concatenate merged cells with 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))

Can de search key of MATCH be a row of values?

I am would like to use the values in the name column (search key) and look them up in a table with the headers [name, regular, overtime].
The formula I am using is:
=ArrayFormula(index(rateTable, match(formName,workers,0),match(formType,rateTypes,0),0)*{formHours})
It works except the search key in the MATCH formula, does not reference every respective entry in the name column, but only works with one fixed reference to a cell.
Am I trying to use this formula beyond its capabilities? I'd like to know if I should stop searching. Thanks.
Here is a link to a copy of my sheet:
https://docs.google.com/spreadsheets/d/1sovuTB4zSTpl0RUHciYltr-pf8g4KPTgkYVE5lB4Ifk/edit?usp=sharing
=ArrayFormula(index(rateTable, match(formName,workers,0),match(formType,rateTypes,0),0)*{formHours})
for this task is best if you use VLOOKUP formula. paste in I2 cell:
=ARRAYFORMULA(IF(LEN(formName), IFERROR(VLOOKUP(formName, rateTable,
IFS(formType="Regular", 2,
formType="Overtime", 3), 0)) * formHours, ))
demo spreadsheet
INDEX doesn't work with arrays as needed for ARRAYFORMULA. Either…
use copied formulas rather than a single ARRAYFORMULA, e.g.
=IF(NOT(LEN(A2)),"",index(rateTable, match(C2,workers,0),match(G2,rateTypes,0))*H2)
and drag-copy it down column I,
or refactor your INDEX(,MATCH( use to rely instead on VLOOKUPs and HLOOKUPs.

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