Google spreadsheet Multiple result with VLOOK UP - google-sheets

The VLOOKUP formulas which works individually are
=if(VLOOKUP(E2,DB!$C:$E,1,0)>0,"COMPLETED",)
=if(VLOOKUP(E2,DB!$F:$H,1,0)>0,"IN PROGRESS",)
The issue is while displaying both results in a single cell, the formula which I came up for this was
C2=if(AND(VLOOKUP(E4,DB!$C:$E,1,0)>0),"COMPLETED",if(VLOOKUP(E4,DB!$F:$H,1,0)>0,"IN PROGRESS","UNDEFINED"))
I have tested the formula with normal conditions other than VLOOKUP and it works without any issues, not sure what's wrong with it.
Example : C10=if(AND(E10=1),"ONE",if(E10=2,"TWO","NO DATA"))
Any help appreciated.
May be its something simple but I am pulling my hair out for the last 3 hours.
Thanks :)
/-----------------------/
Updated 03.05.2016
Sorry for the comments that I have posted as I am new at using Stack overflow.
I have tried with only IF statements without any AND conditions, but the result is still same. The VLOOKUP is not returning the second value.
C15=IF(VLOOKUP(E15,DB!$F:$H,1,0)>0,"COMPLETED",if(VLOOKUP(E15,DB!$F:$H,1,0)>0,"IN PROGRESS","UNDEFINED"))
What I am expecting in cell C2 (sheet1) is check the values in cell
E2 against the columns C:H ( Sheet 2/ DB). If it belongs to
Column C:C in (sheet2/DB) then the value in C2 (sheet1) should display
as "Completed" else if the value is in column F:F ( sheet2/DB) then in C2
(sheet1) should display "In Progress".
Link to my spreadsheet link

There are a few problems with your formula.
VLOOKUP and similar functions search within a single row or column, and it seems like you're looking for your value in multiple rows and columns.
As #Meta mentioned, VLOOKUP returns N/A when the value is not found in the range, and you are expecting a zero or less value to be returned (when you check for >0 in the IF statement). Note that VLOOKUP returns the cell value itself and not an index of a match (like the MATCH function).
My suggestion is to replace your VLOOKUPs with COUNTIF.
=IF(COUNTIF(DB!$F:$H,E2)>0,"COMPLETED",IF(COUNTIF(DB!$C:$D,E2)>0,"IN PROGRESS","UNDEFINED"))
COUNTIF counts in multiple rows and columns, and will return a zero if no matches are found.

Related

How to get last number in a row on Google Spreadsheets

Spreadsheet
So Basically i'm building a sheet to monitor my NW, my problem is simple, i need the 2023 column to adapt to whatever last number on that row there is, for income i just sum values, but for example the total amount in my bank account is different every month, i just need 2023 column to track that, i update the 31 of each month.
With the formula you can see in the screenshot i have some problem, if i input the number alright, if the value is defined by other formulas it won't show up. Any solutions?
THANKS
Only formula present in the row
Another formula from the comments that seems to not work
I tried =INDEX(X:Y;1;COUNTA(X:Y)) but it won't update if the last number in the row is generated by other formulas.
You can use this formula to find the last value of each row in the range D2:O26. Adapt it as needed!
=BYROW(D2:O26,LAMBDA(e,XLOOKUP(1,INDEX(1/(e<>"")),e,,0,-1)))
Explanation:
BYROW creates an array formula in each row of the range. To each row, here denoted as e, the specified lambda function is applied.
INDEX(1/(e<>"")) returns an array with 1 in places where cell is not empty, and #N/A for empty cells.
XLOOKUP finds the index of the last occurrence (parameter search_mode set to -1) of 1 (first parameter) in the array returned by INDEX and returns corresponding value in the row.
You haven't show what formula in columns Jan-Dec causes you problems. If formula produce values 0 in case you don't what them to count, you can use countif to filter them out:
=INDEX(D13:O13,1,COUNTIF(D13:O13,">0"))
Same as your solution, this only works if columns are filled sequentially - if there are no gaps in each row, e.g. Jan and Mar are filled while Feb is blank.
If you need a more general solution, you may go with series of nested if(isblank(). Here is an example for the first three months, to get an idea:
=INDEX(D13:O13,1,IF(ISBLANK(F13),if(ISBLANK(E13),1,2),3))

Summing specific values in a joined list

I am having some difficulties summing up some values in Google Sheets. In my spreadsheet, from multiple other tabs, values and bonuses are combined into one cell (Cell B1 in this example). The format of each "unit" of data is Name,5%xxx (Where "Name" is the name of the item, "5%" represents the sum I want to add, mostly always a percentage, and "xxx" separates one unit from the next). As you can see in cell B1, there are two instances where "Parkour" receives a bonus to sum up (from different sources).
Parkour,5%xxxParkour (Subskill: Sense of Balance),10%xxxParkour,2%xxx
Parkour
0.07
Parkour (Subskill: Sense of Balance)
H2H Combat: Parkour
The formula in cell B2 is:
=IFERROR(SUM(ARRAYFORMULA(IFERROR(VALUE(MID(FILTER(SPLIT(TEXTJOIN("",TRUE,filter(B$1,regexmatch(B$1,$A2)=TRUE)),"xxx"),SEARCH($A2,SPLIT(TEXTJOIN("",TRUE,filter(B$1,regexmatch(B$1,$A2)=TRUE)),"xxx"))),len($A2)+2,1000)),""))),"")
(Dragged down through the rest of the list) (Could not figure out how to make the formula "in line" on the question.)
Expected Results:
B2 = .07 (Working)
B3 = .1 (Not working)
B4 = Blank (Working)
The goal of the formula is to look into cell B1, and split everything out by "xxx". Then, filter the array of items with only exact matches with the line item in column A, then split again by the comma and add up those values. It worked for the first line item, but not the second. (Unsure why, but I strongly believe it has something to do with the parenthesis. When I removed the parenthesis from the name in Column A (and adjusted cell B1 to not have parenthesis), it worked. However, given the structure of the data, parenthesis are required, and I need to find a way for it to work with them.)
When I removed the IFERROR wrap around it in cell B3, I get this error note:
Function SUM parameter 1 expects number values. But " is a text and cannot be coerced to a number.
Any help is greatly appreciated.
You may find useful combining SPLIT with QUERY like this. It will group names and sum percentages:
=QUERY(INDEX (IFERROR(SPLIT(FLATTEN(INDEX(SPLIT(B1:B100,"xxx"))),","))),"SELECT Col1,SUM(Col2) where Col1 is not null group by Col1")
PS: invented a couple of extra line
UPDATE
I've thought you had another goal, try this formula. Having the previous chart generated by QUERY, I used VLOOKUP to match first column and return second one:
=INDEX(IFERROR (VLOOKUP(A2:A,QUERY(INDEX (SPLIT(FLATTEN(SPLIT(B1,"xxx")),",")),"SELECT Col1,SUM(Col2) where Col1 is not null group by Col1"),2,0)))

Troubleshooting formula with array - array arguments are of different size to EQ

In Google Sheets, I have a formula that displays the value of an item in a row if one of its cells contains any of the values listed in a different sheet. It looks like this:
=ARRAYFORMULA(IF(OR(L2 = ZRSKUs!$A$1:$Z$12005), O2, "0"))
If L2 contains any of the values in sheet ZRSKUs, this formula displays the value of the item, which is held in O2. If I drag the formula down it produces the value of every column and I can then get a SUM of this column. I wanted a way to do this without having to drag the formula down every single row (this spreadsheet has about 20,000 rows so it takes a long time to do). I also wanted the formula to add it up too, so it is all done in one cell.
I tried editing the formula to do this, and this is what I came up with:
=ARRAYFORMULA(SUM(IF(OR($L3:$L = ZRSKUs!$A$1:$A$500), $O3:$O, "0")))
However, this gives me an "Array arguments to EQ are of different size" error. I tried adjusting the number of rows in the ZRSKUs sheets so it had the exact same number as my other sheet, but this made no difference.
I'm not sure what's going wrong, so any help or advice would be greatly appreciated!
You get the error because that is not a well-formed array formula, as $L3:$L and ZRSKUs!$A$1:$A$500 are not equal in length. We could rectify this by using another function for the lookup, in this case, MATCH:
=ARRAYFORMULA(SUM(IF(ISNA(MATCH($L$1:$L, ZRSKUs!$A$1:$A$500, 0)), 0, $O$1:$O)))

Google Spreadsheet Function That Sums Numbers In A Column When the Row Contains An EXACT Text

I've been at this problem for a while now. I am trying to sum numbers under a specific column when the rows equal a certain text and then display that sum on a different sheet. So far I came up with this formula: =IF(EXACT(A2,Table!A2:A)=TRUE,SUM(Table!C2:C)); however the only problem is that is sums everything in column C (which makes sense).
I wish there was a way to do something like the following: SUM(Table!C2:C where EXACT(A2,TABLE!A2:A)=TRUE). I've also tried the SUMIF(), DSUM(), and QUERY() functions to no avail. I must be getting logically tripped up somewhere.
Figured it out: =SUM(FILTER(Table!E4:E, EXACT(Table!A4:A,A4)=TRUE)).
=sum ( FILTER (b1:b10, a1:a10 = "Text" ) )
// the above formula will help you to take the sum of the values in column B when another column A contain a specific text.
The formula is applicable only in Google Spreadsheets

Google Sheets: Lookup last matching values but with expanding rows

I'm using a dynamic, expanding sheet containing form responses. Search keys are in A2:A, responses are in the Responses sheet. So,
To get an expanding VLOOKUP, I do:
=ARRAYFORMULA(VLOOKUP(A2:A, Responses!A2:C, 3, 0))
To get the last matching value (for example, latest timestamp) of a repeating search key, I use a combination of FILTER, MAX, and INDEX like so:
=INDEX('Responses'!C2:C, MAX(FILTER(ROW('Follow-up Responses'!A2:A), 'Responses'!A2:A=A2)))
And this works by just dragging it down, but is there a way to make this expanding in an ARRAYFORMULA function? I tried modifiying it as ranges but all I get is one row. My form responses are added quickly so there may come a time where the formula has not been dragged down to the most current.
Thanks!
Sample formula with lookup of last value using row:
=VLOOKUP(D2 ; SORT(FILTER({$A:$B\ROW($A:$A)};$A:$A<>"");3;0) ; 2;)
D2 -- search value
A:B -- initial
row(A:A) -- any row for getting last values in the top.

Resources