I have two spreadsheets, in 1 I have several recipes with the total. In the other sheet the client can choose 2 recipes. I would like to SUM the total of each selected recipe, but I don't know how to do this in the google spreadsheet. I thought of the following algorithm.
SELECTED RECIPE (COLUMN + 1):(ROW + 4)
i.e If the client select
RECIPE 1 (A + 1) = B : (1 + 4) = 5
TOTAL = B:5
RECIPE 3 (A + 1) = B : (7 + 4) = 11
TOTAL = B:11
use:
=ARRAYFORMULA(SUM(QUERY(SPLIT(TRIM(FLATTEN(
SPLIT(QUERY(FLATTEN(IFERROR(IFNA(REGEXEXTRACT(Sheet1!A1:E,
TEXTJOIN("|", 1, G1:I1))), "♠"&Sheet1!A1:E&"♦")),,9^9), "♦"))), "♠"),
"select Col2 where Col1 matches '"&G1&".+|"&H1&".+'", 0)))
spreadsheet demo
You data is really not set up in a readable format for excel. If you want it to be easier to scale (such as if you have a lot of recipes), you should set up the data to look like this and use this formula
=iferror(index(F19:F20,match(A23,A19:A20,0)),0)+iferror(index(F19:F20,match(B23,A19:A20,0)),0)
If you really want to use your current data format, you could use an if statement for each recipe
=if(A14="Recipe 1",B5,if(A14="Recipe 2",E5,if(A14="Recipe 3",B11,if(A14="Recipe 4",E11,0))))+if(B14="Recipe 1",B5,if(B14="Recipe 2",E5,if(B14="Recipe 3",B11,E11,if(B14="Recipe 4",E11,0))))
Related
I want to use Sparkline for a spreadsheet to show a trend of the last 5 soccer matches, where A and B are the goals, and C are the resulting points.
In column C, the points are only generated if values are entered for the goals and goals conceded, i.e. the columns are not empty.
A (Goals)
B (Conceded)
C (Points)
4
4
1
4
4
1
4
4
0
3
4
4
1
0
4
0
As you see, in row 3, column c is empty.
What I basically try to achieve, is to create a list where the last 5 entries which are not empty / null, are listed:
C (Points)
1
1
3
1
0
Is used this formula, but it somehow does not work
=query(J15:J114,"select * offset "&count(J15:J114)-5)
shorturl.at/gHPY9 (example result picture)
Tried to find a solution myself, but am stuck.
Best,
Feal
Use query() with a where clause, like this:
=query(
J15:J114,
"where J is not null
offset " & max(0, count(J15:J114) - 5),
0
)
I have 28 different tabs representing weekly data. They are titled W1, W2, W3 .... all the way up to W28. They are identically laid out just different data.
On a separate tab I am trying to SUM some fields from each week.
That tab will look like so
Week - Wins
1 - 4
2 - 2
3 - 3
the static formula for the first row in the win column would be:
=SUM('W1'!AW2:AW7)
But I want to make it dynamically reference the sheet name. Let's assume Week # is column C and they start in row 4. This formula seems to return the proper sheet names:
="'W"&INDIRECT("C4:C31")&"'" (Gives me 'W1', 'W2', 'W3', etc in the corresponding wins column)
But I am unable to combine it with the above SUM formula to dynamically reference the sheet name.
=SUM("'W"&INDIRECT("C4:C31")&"'"&!AW2:AW7) -> Formula Parse Error
=SUM('W&INDIRECT("C4:C31")&'!AW2:AW7) -> Unresolved Sheet Name W&INDIRECT("C4:C31")&
I've tried other variations with no luck so far.
Any suggestions?
Thanks
example:
formula:
=SUMPRODUCT(REDUCE(, SEQUENCE(28), LAMBDA(a, b, {a; IFERROR(IMPORTRANGE(
"1ToGglifTsqotZ0jDthW2rojWbIXRYPvKUHpdJVzpZ_I", "W"&b&"!B2:B5"))})))
or:
=SUM(REDUCE(, SEQUENCE(28), LAMBDA(a, b,
{a; IFERROR(INDIRECT("W"&b&"!B2:B5"))})))
update:
=QUERY(REDUCE(, SEQUENCE(28), LAMBDA(a, b,
{a; SUM(IFERROR(INDIRECT("W"&b&"!B2:B5")))})), "offset 1", )
This question already has answers here:
Repeat whole row N times based on column value in Google Sheets
(2 answers)
Closed 5 months ago.
The idea here is to create a backup table to enable a faster filling of repeated information in another worksheet.
Dataset:
Exam Parameter Step System Samples
b-HCG OD Calibration 1 5
TSH OD Calibration 2 3
where Col1 = Exam, Col2 = Parameter, Col3 = Step, Col4 = System
enter image description here
So I've been trying to repeat each line x times. X is defined by the nº of samples in each analysis and I would like to return the repeated set in a merged table. For example, all info in row 1 repeated 5 times, row 2 repeated 3 times and so on.
To make a dynamic formula, I tried the following:
=TRANSPOSE(SPLIT(REPT(B3&"|";F3);"|"))
=TRANSPOSE(SPLIT(REPT(C3&"|";F3);"|"))
=TRANSPOSE(SPLIT(REPT(D3&"|";F3);"|"))
=TRANSPOSE(SPLIT(REPT(E3&"|";F3);"|"))
enter image description here
By this I can get the repeated set but just for the first row. If I try to autofill the remaining rows with the above formula, the original formula is overwritten, and I get the repeated data set for the 2nd row instead.
Can I solve this with native formula only or is this only manageable by JavaScript?
try:
=INDEX(SUBSTITUTE(SPLIT(FLATTEN(SPLIT(QUERY(REPT(FLATTEN(
QUERY(TRANSPOSE(SUBSTITUTE({"♦"&A2:A, B2:D}, " ", "♠")),,
9^9)), E2:E),,9^9), "♦")), " "), "♠", " "))
I have two spreadsheets with names and times. One is specific session times and on the second sheet, I want to sum up the total times based on each instance from sheet one.
Sheet 1: Session Time
Name | Time
David 5
Mike 2
Daniel 3
David 2
Daniel 8
Sheet 2: Total Time (The one for which I need a forumula)
Name | Total Time
David 7
Mike 2
Daniel 11
I tried a countif and vlookup but I couldn't get it match more than one instance of the name on sheet 1. I also tried this suggested formual from a suggested post but its not summing a second instance of the user name
=ARRAYFORMULA(SUM(ifna(VLOOKUP(A2, 'Sheet 1'!A3:AA16, 5, false))))
A2 = David (On Sheet 2)
Sheet 1'!A3:AA16 = List of names in columns A and all the way to AA is a series of columns with numerical values
5 = the column number from with I want to return the sum for every instance of David (2 in this example with a total of 7)
False = its not sorted
Any help is mucho appriciado!
You can use this formula in your Sheet2!B1:
={"Total Time";arrayformula(if(A2:A<>"",sumif(Sheet1!A1:A,A2:A,Sheet1!B1:B),""))}
Or simply use =arrayformula(if(A2:A<>"",sumif(Sheet1!A1:A,A2:A,Sheet1!B1:B),"")) in Sheet2!B2
Get the sum of the range based on a specific criteria using SUMIF()
Basically, get the sum of Sheet1!B1:B if Sheet1!A1:A matches the current cell being checked in arrayformula A2:A
Output:
This can be accomplished with a simple QUERY, e.g.,
=QUERY('Session Time'!A:B, "Select A, SUM(B) WHERE A Is Not Null GROUP BY A LABEL SUM(B) 'Total Time'")
I have a spreadsheet containing a list of assessments for students. It is comprised of four columns:
A B C D
Student Standard Date Score
On another sheet I have a table containing a list of students in column A and a list of standards in Row 1.
I want to query the spreadsheet of assessments to return the score of the most recent assessment for the current student on the current standard. Currently I have this formula in cell K3:
=Query(Assessments!A:D,"select D where(A="&$A3&" and B="&K$1&") order by max(C) limit 1")
but it gives me this error:
Unable to parse query string for Function QUERY parameter 2: AGG_IN_ORDER_NOT_IN_SELECTMAX(C)
Edit:
I've gotten some great answers, but I guess I asked poorly. What I really need is the score from the most recent assessment. The results from JPV and pnuts have both given the date of the most recent assessment. Here is a stripped down version of the actual file: spreadsheet.
In the Students sheet I'm needing a formula in the Green cells that results in a number from 0 to 4 based on the data in the Assessments sheet.
This is why in the query I was trying to select D, but order by max(C).
I tweaked one of these formulas and got:
=iferror(query(A3:D20, "Select D where A = '"&G20&"' and B = '"&I20&"' order by C desc limit 1",0), "no data found")
I addition to the fine solution provided by pnuts (+1 for the sample data), here are some posibilities using query (check the green cells in this spreadsheet.
=query(A2:D20, "select A, MAX(C) GROUP BY A pivot B",1)
or
=query(A2:D20, "select A, B, MAX(C) GROUP BY A, B",1)
should create a table with the latest date per student, per standard.
In case you want to use cell references (where a cell holds a student name and another cell holds the standard), try:
=iferror(query(A3:D20, "Select A, B, C where A = '"&G20&"' and B = '"&I20&"' order by C desc limit 1",0), "no data found")
where G20 is student name and I20 is standard (change range to suit).
Does not use the query function but seems to "query the spreadsheet of assessments to return the most recent assessment for the current student on the current standard":
=iferror(max(filter(Assessments!$A$1:$D$99,Assessments!$A$1:$A$99=$A3,Assessments!$B$1:$B$99=K$1)),"")
Constructed data as example:
Student Standard Date Score
Bod5 C 2/2/2015 9
Bod6 B 1/1/2015 8
Bod7 C 7/7/2015 7
Bod8 A 9/9/2015 6
Bod1 B 3/3/2015 5
Bod2 C 4/4/2015 43
Bod3 B 6/6/2015 2
Bod4 C 1/1/2015 1
Bod1 A 1/1/2016 8
Bod1 A 2/2/2017 7
Bod1 A 1/1/2013 6
Bod1 A 1/1/2011 5
Bod9 A 9/9/2009 9
Bod9 B 1/1/2011 3
Bod9 C 3/3/2013 2
Bod9 A 10/10/2010 4
Bod9 B 11/1/2001 2
Bod9 C 4/4/2014 1
Output: