VLookup search for columns concatenation - google-sheets

I have a search term which spans into 3 columns.
text_A, text_B, text_C
I'm trying to find the A column value for a row which forms almost the same values:
text_A, text_B, text that starts with text_C
I get no result even before handling the search of starts with text_C, even though I expected to get one.
Any tip on how to change this?
=VLOOKUP(I10:I&"^"&J10:J, C10:C&"^"&D10:D, 1, FALSE)

try:
=INDEX(IFNA(VLOOKUP(I10:I&"^"&J10:J, {C10:C&"^"&D10:D, E10:E}, 2, 0)))
update
=ARRAYFORMULA(IFNA(VLOOKUP(I10:I&"×"&J10:J&"×"&K10:K,
{C10:C&"×"&D10:D&"×"&IFERROR(REGEXEXTRACT(E10:E&"",
TEXTJOIN("|", 1, SORT(K10:K, 1, 0)))), B10:B}, 2, 0)))

Related

Google Sheets - Add seperate columns and show sum on another sheet

Ok. Here's my problem. I have a sheet that is created by a Google Form. It is formated like this...
This is part of an INVENTORY CONTROL. This sheet is showing the INCOMING stock. What I want to do is ADD each column (that could go infinately) for example Col B SVHD-01-8OZCUP and display that number on G2 on the sheet below. I also have another sheet that is basically the same showing OUTGOING stock and the sum of its columns would go in H below.
Then I just Subtract H from G in each row to get the Current Inventory. All I need help on is getting the Check-In Totals and Check-Out Totals from the above sheet onto the below sheet. Thanks.
UPDATE 2:
Making the SEQUENCE part of the formula dynamic as per the discussion in comments:
=ArrayFormula(IFNA(VLOOKUP("sum "&A2:A, TRANSPOSE(QUERY({'Re-Order'!A1:DF}, "select "&TEXTJOIN(", ", 1, ("sum(Col"&SEQUENCE((COUNTA('Re-Order'!1:1)-1), 1, 2)&")"))&"", 1)), 2, 0)))
This will only work if you do not have empty columns in the sheet.
UPDATE:
Added this formula in D2 in your Test B sheet:
=ArrayFormula(IFNA(VLOOKUP("sum "&A2:A, TRANSPOSE(QUERY({'Re-Order'!A1:DF}, "select "&TEXTJOIN(", ", 1, ("sum(Col"&SEQUENCE(109, 1, 2)&")"))&"", 1)), 2, 0))) and it seems to be working. Let me know if you have any questions.
PREVIOUS ANSWER:
Based on the screenshots that you have shared (I have not looked at the sheet in the comments) one way to do it is to sum all columns individually in the form and then lookup the value against the product in the second sheet (screenshot 2 of your question)
You can use the following formula in G2 in your the sheet in screenshot 2 of your question:
=ArrayFormula(VLOOKUP("sum "&A2:A, TRANSPOSE(QUERY({inventory_control_sheet_nameA1:DF}, "select "&TEXTJOIN(", ", 1, ("sum(Col"&SEQUENCE(109, 1, 2)&")"))&"", 1)), 2, 0))
This assumes that the input has columns through DF.

Google sheets, how to create a table of Vlookup and get the last occurrence for each customer

I have a database of customers, where his zone, seller and some other values can change, and I want to generate a table of the last occurrence of each one
Heres a demo sheet
using Vlookup doesn't get the last occurrence
My database is very big and I need something to not slow my sheet that much, because I was using a formula like this one for each cell
=ARRAYFORMULA(LOOKUP(2,1/(C2:C=A2),$D$2:$D))
but the sheet is very slow because of this
Any help on this please ?
use:
=ARRAY_CONSTRAIN(SORTN(SORT({C3:E, B3:B}, 4, 0), 9^9, 2, 1, 1), 9^9, 3)

Summation formula needed

I need help with creating a formula in Google Sheets for the sum of:
x*(0.95^1+0.95^2+0.95^3+...+0.95^n)
where x is a constant, and n is a positive integer. The formula must fit in one cell.
=x*SERIESSUM(.95,1,1,{1,1,1,1,1})
While there very possibly a ready-made statistical or financial worksheet function for this, you seem to be happy with the results from this formula offered in another answer.
You just need to generate the array n times with n being the value from a cell on the worksheet.
INDEX(ROW(1:4), , ) returns a result of {1, 2, 3, 4} as a true array.
To convert {1, 2, 3, 4} to {1, 1, 1, 1} use a SIGN function 'wrapper' around the row numbers.
=INDEX(SIGN(ROW(1:4)), , ) 'returns {1, 1, 1, 1} as a true array
To vary the length of the array, use INDIRECT to build the ROW reference. With 4 in C10, this returns the same result.
=INDEX(SIGN(ROW(INDIRECT("1:"&C10))),,) 'returns {1, 1, 1, 1} as a true array
'proof
=SUM(INDEX(SIGN(ROW(INDIRECT("1:"&C10))),,)) 'returns 4
Put that together with the rest of the formula as a standard formula with INDEX in array mode.
=B10*SERIESSUM(0.95, 1, 1, INDEX(SIGN(ROW(INDIRECT("1:"&C10))),,))
If you don't wish to use INDEX in its array mode, you can dispense with it and add an ARRAYFORMULA wrapper instead.
enter image description here
Please try:
=x*SERIESSUM(.95,1,1,{1,1,1,1,1})
where the array has n 1s (5 for example).

Use vlookup to get exact match while is_sorted is TRUE

Is it possible to use Google Sheets VLOOKUP to get an exact match while using the sorted==TRUE option ?
Prefer to use VLOOKUP because I'm return multiple columns.
Would like to use the sort option because the data range is very large
(20,000 rows)
I didn't find any option in while reading the docs. Asking in case, there is an option I may have missed.
EDIT; I also checked the MATCH function, but the sort option is identical to VLOOKUP - so same situation.
EDIT; an ArrayFormula spreadsheet for users to reference
EDIT; full formula for my purposes for reference using Answer (double VLOOKUP) - very fast for even 20,000 rows
ARRAYFORMULA(IF(VLOOKUP(B:B,SORT(UNIQUE(B:B)),1,TRUE)=B:B,VLOOKUP(B:B,QUERY(A:B,"select B, count(A) group by B order by B label count(A) ''"),2,TRUE),0))
The double vlookup approach is to search for the primary key itself first, and only if it's found, proceed to retrieving the values from other columns.
If A:B is already sorted by A, and the value we look for is 42, then the formula is:
=if(vlookup(42, A:B, 1, true) = 42, vlookup(42, A:B, 2, true), na())
where the first vlookup checks if 42 is in column A, and only then passes the job to the second.
If A:B is not sorted, it can be sorted on the fly as in
=if(vlookup(42, sort(A:B), 1, true) = 42, vlookup(42, sort(A:B), 2, true), na())

Ranking Google Sheet Info Uniquely

I am trying to rank the data in one column in my google sheet so that there are no duplicate rankings. I've seen some solutions such as =RANK(A2,$A$2:$A$10)+COUNTIF($A$2:A2,A2)-1, but the problem is that it increments the duplicates based on occurrence in the sheet.
Let's say my data that I'd like ranked is as follows:
1
1
1
2
The rank order would be 2, 3, 4, 1. The problem is, if I change the second entry to 2 (so that my data is now 1, 2, 1, 2) the ranking order becomes 3, 1, 4, 2 instead of 3, 2, 4, 1 like I want. In the original data, the fourth entry was initially the highest and I'd like it to still have the higher rank, but since the formula counts occurrences it gets demoted. Any way to accomplish this?
No, not with native spreadsheet functions. Spreadsheet formulae have no "awareness" of which values were entered most recently.
You would need to resort to Google Apps Script run on an "on edit" trigger.

Resources