I have the following table which I need to have all the values found from multiple ranges vertically.
I was using the following formula, but I'm only getting 1 result and not 7. After getting all those 7 values, I need to add them together in order to get a total.
So far my guess was to try the 2nd formula but obviously is not returning what I need but maybe is something around those corners.
=SUM(ARRAYFORMULA(VLOOKUP(E4,{range0,range1,range2,range3,range4,range5,range6},5,false)))
=SUM(ARRAYFORMULA(VLOOKUP(E4,{range0,range1,range2,range3,range4,range5,range6},{5,5,5,5,5,5,5},false)))
You can use FILTER instead:
Formula:
=SUM(INDEX(FILTER(B6:F, B6:B = "name1"),,5))
Use FILTER to get the rows of B6:F where "name1" is found in B6:B
Use INDEX to get only the specific column which is in our case, 5
Then SUM the column.
Related
Is it possible to use this index formula on multiple columns?
=index(if(Sheet1!B5:B<>"",,Sheet1!A5:A))
[Sample Table]
For the table above, what if we want to add Column C? (If column B and C have data on Sheet 1 - remove them, and if 1 is missing in either column(B or C), it will appear.
The desired results shown in the screenshot suggest that you want the matching data without inserting blank rows in between. To get that, use filter(), like this:
=filter(Sheet1!A5:A, isblank(Sheet1!B5:B)
To add another criterion, and combine the criteria with OR, use the + operator, like this:
=filter(Sheet1!A5:A, isblank(Sheet1!B5:B) + isblank(Sheet1!C5:C))
To get an AND condition, simply add criteria as their own parameters, or use the * operator. See Boolean arithmetic.
FILTER() with MMULT() may give you desired result.
=FILTER(Sheet1!A4:A,MMULT(INDEX(--(Sheet1!B4:C="x")),{1;1})<2)
Here MMULT(INDEX(--(Sheet1!B4:C="x")),{1;1}) will create a vertical array having count how many x do you have in each row. If you have x in both column of each row then MMULT() will return result 2. If you have one x then will return 1 and if there is no x then 0. Then we will filter that vertical array having values less than 2.
MMULT() reference.
I have two columns and am trying to count the nonblank cells in column B based on a specific corresponding value in column A. So I am using COUNTIFS($A$3:$A,"GA",len(trim($B7:$B)),">0") to calculate that.
First criteria range is Column A and the criteria is if cell value equals "GA".
I want the second criteria range to be Column B and the criteria to be len(trim(cell)) > 0 but obviously I am not specifying it correctly and getting the following error, instead of the expected result of 7.
Please help in how I should achieve this.
Typo? Should be...
=COUNTIFS($A$3:$A,"GA",len(trim($B3:$B)),">0")
(You had $B7:$B.)
You can shorten this anyway:
=COUNTIFS(A3:A,"GA",B3:B,"<>")
I am using a Filter Formula Which gives several output. But I need the last one.
Here is my formula:-
=Filter(weather!E:E,weather!U:U="d",DATEVALUE(weather!V:V)=Today())
This gives me out put a,b,c
but I want the last value only c. What is the work around?
You could use COUNT (or COUNTA) to count how many results returns your formula, then use INDEX to get the last result.
Example
Let say, that we have
The following formula will return C
=INDEX(FILTER(A1:A4,B1:B4=2),COUNTA(FILTER(A1:A4,B1:B4=2)))
I have set of columns that I am attempting to calculate the combined total of those columns then subtract from that total 8, if the difference after 8 is equal to or less than 0 I want to only show zero in the column I am doing this formula in. For those who might ask, I am using the ARRAYFORUMLA cause I want this calculation to repeat as I add new rows, keeping the totals I am seeking on the same row as the calculation is being done onto. So far I have most of this working. Well up to the IF ELSE THEN type of portion. My attempt is/was
=if(LTE((B3:B)+(C3:C)-8,0),ARRAYFORMULA((B3:B)+(C3:C)), 0)
As long as I'm understanding you correctly, I believe this will work:
=if(lte(sum(B2:C)-8,0),0,sum(B2:C))
It's at the top of the row and sums columns B and C. You can add more columns easily this way by either changing B/C to something else or passing more columns in.
Sum-8 is greater than 0
Sum-8 is less than 0
If what you want to do is to add each row to the total but only if its sum is 8 or greater, then your original formula was nearly OK but the two parts of the IF statement should have been reversed
=sum(ArrayFormula(if(LTE((B3:B)+(C3:C)-8,0),0,(B3:B)+(C3:C))))
You could also take most of the brackets out
=sum(ArrayFormula(if(LTE(B3:B+C3:C-8,0),0,B3:B+C3:C)))
and this would also work
=sum(ArrayFormula(if(LTE(B3:B+C3:C,8),0,B3:B+C3:C)))
Short answer
ARRAYFORMULA that can show 0 if the value is less than or equal to zero. Otherwise show the value of that set of data:
=ArrayFormula(IF(LTE(A1:A3,0),0,A1:A3))
Explanation
The basic IF syntax requires the use of scalar values, to use it with arrays, ARRAYFORMULA is required as an outer function:
ARRAYFORMULA(IF(array_logical_expression,array_if_true,array_if_false))
For the specific case described on the body of the question, the corresponding formula is:
=ARRAYFORMULA(IF(LTE(B3:B+C3:C-8,0),0,B3:B+C3:C))
Reference
Google Docs editors Help
IF
ARRAYFORMULA
Using arrays in Google Sheets
I have a Google sheet for tracking my weight. I have two columns: Date and Weight. While the goal is to have the weight column sorted in descending order, that doesn't always happen in reality...
The data essentially looks like this (weights changed to far lower values, of course):
Date |Weight
04/01/10|195
04/02/10|194
04/03/10|190
04/04/10|198
etc.
Anyway, I have a cell in another spot on the sheet that shows the minimum value from the weight column using this formula
=(Min(B:B))
What I would like to do is display the corresponding date cell for whatever the minimum value from the weight column is. So, with this dataset, I want to show 190 for weight and 04/03/10 for date. Is there any way to get that corresponding cell? I looked through the function reference for Google docs, but can't get anything going. I tried using some of the functions from the Lookup category, but got nowhere. Most want a cell reference, but the min() function returns a value. I think I need to somehow get min() to give me a cell reference, but I don't know how to do that. HLOOKUP() sort of seemed like it might be appropriate, but the docs were a bit spotty, and it didn't do anything but error out the cell.
Of course, I may be barking up the wrong tree entirely.
Thoughts?
I would use the following two formula's:
MIN(B2:B)
FILTER(A2:A;B2:B=minimal value)
If there are more results, they need to be included as well.
See example file I've created: Getting Corresponding Cell In Google Docs Spreadsheet?
Not barking up the wrong tree, actually very close:
=index(A:A,match(min(B:B),B:B,0))
should meet your requirement.
Working inside out: min(B:B) (as you had) returns the lowest weight (ie 190) in ColumnB.
match then finds the position of that value relative to the start of the range in which the value is searched for. So assuming Date is in A1, that returns 4, being the fourth row in ColumnB, where 190 is. The 0 in the formula is to ensure that only the position of an exact match is returned.
Now we know we need the content of the fourth row we can go looking for the value there in ColumnA with index, returning 04/03/2010.
Not all is ideal however. It is possible that a weight of 190 was achieved on separate days. It is the nature of match that where an exact match is required and found the function stops looking for any further instances. Hence as things stand 04/03/2010 will be returned for 190 however often that is the weight for a day after 04/04/2010 - unless other steps are taken, such as to delete/remove/ignore data from 04/03/2010.
You need to change the order of the column as the search column (the weight should be the first in the search array. Then you can use the VLOOKUP formula:
=VLOOKUP(C7,A:B,2,false)
C7 holds the MIN formula that you used: =(Min(A:A)) - note the column order change
one-cell solution to get minimal value with the latest day:
={MIN(B:B), TO_DATE(VLOOKUP(MIN(B:B), SORT({B:B,A:A}, 2, 0), 2, 0))}
to get all minimal values with dates:
=QUERY(A:B, "select B,A where B matches '"&MIN(B:B)&"' order by A desc", 0)