How do I utilize VLOOKUP in multiple instances? (Google Sheets) - google-sheets

Slightly complex problem, but hopefully manageable.
Refer to this demo document before reading as I'll be referring to it throughout this post.
What I'm trying to accomplish:
As seen in the demo document, I'm trying to insert "Sticker" images automatically if the following statements are correct:
Within the "Master Sheet" sheet; If the "SKU" number (column 'E') is found on the 'PRICE CHANGE' sheet, Then look under Column 'K' on the 'PRICE CHANGE' sheet.
Within the 'PRICE CHANGE' sheet; If the start of the of the text (on column 'K') start's with a number, find the number that matches on the 'Sticker Images' sheet under column 'B' and insert the image of the corresponding "Sticker" into the "Master Sheet" sheet.
In spoken terms: I want to fetch data from 'Master Sheet' sheet, refer that data to the 'Price Change' sheet, fetch more data from the 'Price Change' sheet, then refer that data to the 'Sticker Images' sheet, then finally bring the correct image from the 'Sticker Images' sheet and place the image in its correct spot on the 'Master Sheet' sheet.
Here are some visuals if my explanation still wasn't good enough 😂
The problem I'm having: I can't seem to find a way to make the formula understand I'm looking for just the single value only at the START of the text on column 'K' within the 'PRICE CHANGE' sheet.
Here is the formula I'm using at the moment:
=IFERROR( VLOOKUP( IFERROR( LEFT( VLOOKUP( $E12, 'PRICE CHANGE'!$E$18:AC25, 12, 0), 1)), 'Sticker Images'!B:C, 2, 1))
Things to keep in mind:
I cannot edit the 'PRICE CHANGE' sheet in any way.
The "Men's Ultraboost 22 Running Shoe" should have a yellow sticker and the "Women's GEL-Kayano® 28 AWL Running Shoe" should have a red one (Just for validation/Check your work).
Thanks in advance for any answers/help!

You can use a single, simplified formula for all.
Within your Master SheetClear everything in the range F12:F and place this formula in cell F12
=INDEX(IFERROR(VLOOKUP(LEFT(
VLOOKUP(E12:E,'PRICE CHANGE'!E19:K,7,0)),'Sticker Images'!B:C,2)))

Try this
=IFERROR( VLOOKUP( IFERROR( LEFT( VLOOKUP( $E12, 'PRICE CHANGE'!$E$18:AC, 7, 0), 1)), 'Sticker Images'!B:C, 2, 1))
Keep the vlookup range open ended 'PRICE CHANGE'!$E$18:AC
The index in your formula is set to 12 is suppose to be set 7 to get the column K .

The existing formula already works, as long as typo (or typo-like) errors are fixed:
=VLOOKUP(LEFT(VLOOKUP($E12, 'PRICE CHANGE'!E:K, 7, 0), 1)), 'Sticker Images'!B:C, 2, 1))
Note the 7 instead of 12. The key thing is to fix the column index for range E:K. (And have the correct row index for that range, and correct fixed vs iterative indices choices. I also changed AC to K since you only are referring to column K. May as well avoid a potential source of error by referring a larger range than you intend to have sheet content.)
I did test using Google Sheet. No guarantee how things turn out in Excel.
I don't usually post an answer for fixing small errors. The OP has everything correctly set up already. But posted nonetheless as requested.

Related

Importing values of column from other sheet based on a matching values in a different column across both sheets?

Hey Stack Overflow Sheets, I have a question regarding a use case we want to create in our Google Sheet, either with built-in functionality, or with an extension like Sheetgo.
We have 2 sheets with multiple of the same columns (properties) and rows (users). The problem is that only one of the sheets is a trusted source for one column’s data (“source sheet”), and the other sheet has empty or outdated values for the same column (“outdated sheet”), and we need both sheets to have this column match values in rows that have a matching value for another column across both sheets (in our case, an “email” column). After they’re matching, we want to change the formula to sync any changes made for that column between both sheets.
Here’s an obfuscated data example:
Source sheet:
https://docs.google.com/spreadsheets/d/1uxqC3lB15UHhKTzjZyzzVIj5tlPjhCCCZ48xHYEcm0o/edit?usp=sharing
Outdated sheet:
https://docs.google.com/spreadsheets/d/1ckoCh8gMwt2QeBRH1dB2dyFPJUukrjQ-SCgucTL8rhc/edit?usp=sharing
In the example, we’re looking for a formula that would allow us to have a “Type” column value injected into the Outdated Sheet’s Type column, based on both sheet’s matching Email column value. And then, have it so if a row’s “Type” value changes in either doc, the other doc follows.
What formula or extension would I use to go about this? Any help appreciated, thanks!
I tried to create a VLOOKUP and MATCH formula, but I couldn't yet figure out how to have the function first LOOKUP into the Source Sheet, then inject it into the Outdated Sheet based on a matched email column value. Sheetgo made the LOOKUP easier, but I still couldn't figure out how to do an exact operation.
Use importrange() and vlookup(). Put this formula in cell A1 of the target spreadsheet:
=arrayformula(
lambda(
import,
iferror(
vlookup(
C1:C,
{ index(import, 0, 3), index(import, 0, 1) },
2, false
)
)
)(
importrange("1uxqC3lB15UHhKTzjZyzzVIj5tlPjhCCCZ48xHYEcm0o", "Sheet1!A1:F")
)
)

Why my ArrayFormula is giving error? How do I correct it? (I'm not looking for another Arrayformula as solutions!)

I wanted a ArrayFormula at C1 which gives the required result as shown.
Entry sheet:
(Column C is my required column)
Date Entered is the date when the Name is Assigned a group i.e. a, b, c, d, e, f
Criteria:
The value of count is purely on basis of Date Entered (if john is assigned a on lowest date(10-Jun) then count value is 1, if rose is assigned a on 2nd lowest date(17-Jun) then count value is 2).
The value of count does not change even when the data is sorted in any manner because Date Entered column values is always permanent & does not change.
New entry date could be any date not necessarily highest date (If a new entry with name Rydu is assigned a on 9-Jun then the it's count value will become 1, then john's (10-Jun) will become 2 and so on)
Example:
After I sort the data in any random order say like this:
Random ordered sheet:
(Count value remains permanent)
And when I do New entries in between (Row 4th & 14th) and after last row (Row 17th):
Random Ordered sheet:
(Doesn't matter where I do)
I already got a ArrayFormula which gives the required result:
={"AF Formula1"; ArrayFormula(IF(B2:B="", "", COUNTIFS(B$2:B, "="&B2:B, D$2:D, <"&D2:D)+1))}
I'm not looking for another Arrayformula as solutions. What I want is to know what is wrong in my ArrayFormula? and how do I correct it?
I tried to figure my own ArrayFormula but it's not working:
I got Formula for each cell:
=RANK($D2,FILTER($D$2:$D, $B$2:$B=$B2),1)
I figured out Filter doesn't work with ArrayFormula so I had to take a different approach.
I took help from my previous question answer (Arrayformula at H3) which was similar since in both cases each cell FILTER formula returns more than 1 value. (It was actually answered by player0)
Using the same technique I came up with this Formula which works absolutely fine :
=RANK($D2, ARRAYFORMULA(TRANSPOSE(SPLIT(VLOOKUP($B2, SUBSTITUTE(TRIM(SPLIT(FLATTEN(QUERY(QUERY({$B:$B&"×", $D:$D}, "SELECT MAX(Col2) WHERE Col2 IS NOT NULL GROUP BY Col2 PIVOT Col1", 1),, 9^9)), "×")), " ", ","), 2, 0), ","))), 1)
Now when I tried converting it to ArrayFormula:
($D2 to $D2:$D & $B2 to $B2:$B)
=ARRAYFORMULA(RANK($D2:$D,TRANSPOSE(SPLIT(VLOOKUP($B2:$B, SUBSTITUTE(TRIM(SPLIT(FLATTEN(QUERY(QUERY({$B:$B&"×", $D:$D}, "SELECT MAX(Col2) WHERE Col2 IS NOT NULL GROUP BY Col2 PIVOT Col1", 1),, 9^9)), "×")), " ", ","), 2, 0), ",")), 1))
It gives me an error "Did not find value '' in VLOOKUP evaluation", I figured out that the problem is only in VLOOKUP when I change $B2 to $B2:$B.
I'm sure VLOOKUP works with ArrayFormula, I fail to understand where my formula is going wrong! Please help me correct my ArrayFormula.
Here is the editable sheet link
if I understand correctly, you are trying to "rank" B column based on D column dates in such way that dates are in theoretical ascending order so if you randomize your dataset, the "rank" of each entry would stay same and not change based on the randomness you introduce.
therefore the correct formula would be:
={"fx"; INDEX(IFNA(VLOOKUP(B2:B&D2:D,
{INDEX(SORT({B2:B&D2:D, D2:D}, 2, 1),,1),
IFERROR(1/(1/COUNTIFS(
INDEX(SORT(B2:D, 3, 1),,1),
INDEX(SORT(B2:D, 3, 1),,1), ROW(B2:B), "<="&ROW(B2:B))))}, 2, 0)))}
{"fx"; ...} array of 2 tables (header & actual table) under each other eg. ;
outer shorter INDEX or longer ARRAYFORMULA (doesnt matter which one) is needed coz we are processing an array
IFNA for removing possible #N/A errors from VLOOKUP function when VLOOKUP fails to find a match
we VLOOKUP joint B and D column B2:B&D2:D in our virtual table {} and returning second 2 column if there is an exact match 0
our virtual table {INDEX(SORT({B2:B&D2:D, D2:D}, 2, 1),,1), ...} we VLOOKUP from is constructed with 2 columns next to each other eg. ,
we are getting the first column by creating an array of 2 columns {B2:B&D2:D, D2:D} next to each other where we SORT this array by date/2nd column 2, in ascending order 1 but all we need after sorting is the 1st column so we use INDEX where we bring all rows ,, and the first column 1
now lets take a look on how we getting the 2nd column of our virtual table by using COUNTIFS which will mimic the "rank"
IFERROR(1/(1/ is used to remove all zero values from the output (all empty rows would have 0 in it as the "rank")
under COUNTIFS we put 2 pairs of arguments: "if column is qual to column" and "if row is larger or equal to next row increment it by 1" ROW(B2:B), "<="&ROW(B2:B))
for "if column is qual to column" we do this twice and use range B2:D and sort it by date/3rd column 3 in ascending order 1 and of this we again need only the 1st column so we INDEX it and return all rows ,, and first column 1
with this formula you can add, remove or randomize your dataset and you will always get the right value for each of your rows
as for why your formula doesnt work... to not get #N/A error for vlookup you would need to define the end row of the range but still, the result wont be as you would expect coz formula is not the right one for this job.
as mentioned there are functions that are not supported under AF like SUM,AND,OR and then there are also functions which work but in a different way like IFS or with some limitations like SPLIT,GOOGLEFINANCE,etc.
I have answered you on the tab in your shared sheet called My Practice thusly:
You cannot split a two column array as you have attempted to do in cell CI2. That is why your formula does not work. You can only split a ONE column array.
I understand you are trying to learn, but attempting to use complicated formulas like that is going to make it harder I'm afraid.

Trouble with a single cell formula being converted to a full column formula

I have a Google Sheet that has a Google Form populating the results of many games that a friend and I play. I have created a new column and added a formula to the top cell in that column and just copied it down the column:
=JOIN(" / ",(FILTER(MyDecks!B$2:B,MyDecks!A$2:A=B5)),(FILTER(HisDecks!B$2:B,HisDecks!A$2:A=C5)))
MyDecks column A is a list of deck names.
MyDecks column B is an attribute of each deck, which is the desired return value.
B5 and C5 are both within columns of the Sheet tab where the formula exists.
The output when using the formula above is something like "M / P", for example.
This formula however, currently has to be copied and pasted, or just extended down to the new cells any time I add another entry with the Google Form.
I would like this formula to be altered so that it will function the same as it does currently, but have it reside within the column head itself so that new entries will just accept and render the formula automatically for the new entries that I create.
I have tried:
=ArrayFormula(IF(ROW(D:D)=4,"Matchup",IF(ISBLANK(C:C),"",JOIN(" / ",(FILTER(MyDecks!B$2:B,MyDecks!A$2:A=B$5:B)),(FILTER(HisDecks!B$2:B,HisDecks!A$2:A=C$5:C))))))
and many other iterations of the same idea, to no avail. I am a novice and am hoping that there is an easy solution to my issue.
use:
={"Matchup"; ARRAYFORMULA(IFNA(
VLOOKUP(B5:B, JoeDecks!A2:B, 2, 0)&" / "&
VLOOKUP(C5:C, BryanDecks!A2:B, 2, 0)))}

Finding a min() value on each row using an arrayformula() within Google Sheets

I'm kind of in a pickle with a sheet I've been working on, I was looking for some clarification. For some reason my old account is gone that Ive for years :(, I apologize.
I'm trying get a min value for each row I've added data in. There is 2 columns where I need to convert the data first, and then find the lowest value for for all 3 columns for each row.
I've tried multiple things and only entering the formula I've created for each row works perfectly.
For Instance:
=MIN( IF(E124 > 0, E124*$E$6), IF(F124 > 0, F124*$F$6), IF(G124 > 0, G124) )
I've tried to use other examples, however, I am not familiar with QUERY. Trying to do simple calculations (adding) within the formula is confusing. Example I've tried using:
=QUERY(TRANSPOSE(QUERY(TRANSPOSE(A1:C),
"select "&REGEXREPLACE(JOIN( , ARRAYFORMULA(IF(LEN(A1:A&B1:B&C1:C),
"min(Col"&ROW(A1:A)-ROW(A1)+1&"),", ""))), ".\z", "")&"")),
"select Col2")
That has multiple problems when adding it. I want to ignore empty cells and text like headers. It will not write over text, and does not execute (gives me an error about overwriting values).
I've tried writing an =arrayformula but does not like calculating the min value. It does do the calculations for the rows.
=ArrayFormula(IF(ISBLANK({E8:E;F8:8;G8:8}), "", added my formula here))
Down below was something I've worked on for hours, I believe the problem is selecting the ranges inside the MIN function that is causing the problems
=arrayformula(IF(LEN(E8:G)<>0, MIN( IF(E8:E > 0, E8:E*$E$6), IF(F8:F > 0, F8:F*$F$6), IF(G8:G > 0, G124) ),)
If there's a way to do this, I'd really appreciate some help
LINK: a viewable version of a sample I made as my actual sheet is over 500 lines long.
https://docs.google.com/spreadsheets/d/133LJHY3s45ZyxWq0PWew1KikbyNE4MTt-wOeWHBrZY0/edit?usp=sharing
try (which works for all rows till bottom):
=ARRAYFORMULA(TEXT(SUBSTITUTE(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(E3:G<>"", {E3:E*M5, F3:F*N5, G3:G}, 999^99)),
"select "&TEXTJOIN(",", 1,
"min(Col"&ROW(A3:A)-ROW(A3)+1&")")&"")),
"select Col2", 0), 999^99, ), "$#,###.00"))
In cell O3 give this a try
=ArrayFormula(TO_DOLLARS(index(transpose(query(transpose(E3:G18*{M5, N5, 1}),"select "&join("),","max(Col"&row(indirect("A3:A18"))-2)&")")),,2)))
and see if that delivers the expected output?
In case, you'll have more then one value in the columns E:G you could try
=ArrayFormula(TO_DOLLARS(index(transpose(query(transpose(if(ISNUMBER(E3:G18), E3:G18, 99^99)*{M5, N5, 1}),"select "&join("),","min(Col"&row(indirect("A3:A18"))-2)&")")),,2)))

Filtering and comparing data in Google Sheets

So what I want to do is remove the first word of every name in these columns. Example: "CMSgt Cin" needs to say "Cin" on my datasheet1. I have attempted to do that but am I getting errors.
After I have converted the names, I want the cells that do not apply to the conversion to remain blank on my datasheet1. So basically if the filter is looking for a name such as "CMSgt Cin" but only finds "--" in that cell, I want the filter just make the cell blank on my datasheet1.
My main goal is to see if the names on my reference sheet are also on another sheet which they should be on. So I am filtering and comparing two lists of data, and I want to make it so if they are on my reference sheet but notice sheet I'm comparing it to, their name should appear red. I am willing to talk on discord if this is too confusing to understand
so what I want to do is remove the first word of every name in these columns
=INDEX(SPLIT(A1, " ", 0, 1), 1, 2)
I want the cells that do not apply to the conversion to remain blank on my datasheet1
=IF(ISNUMBER(SEARCH(" ", A1)), INDEX(SPLIT(A1, " ", 0, 1), 1, 2), )
goal is to see if the names on my reference sheet are also on another sheet which they should be on
=ARRAYFORMULA(VLOOKUP(A1:A, 'another sheet'!A1:A, 1, 0))
if they are on my reference sheet but notice sheet I'm comparing it to, their name should appear red
=COUNTIFS($A:$A, $A1, INDIRECT("'another sheet'!$A:$A"), INDIRECT("'another sheet'!$A1"))>1
show all the people who are on my reference sheet but not my data sheet
=QUERY(FILTER({E:E;F:F;G:G;H:H;I:I;J:J},
ISNA(MATCH({E:E;F:F;G:G;H:H;I:I;J:J}, Sheet3!A:A, 0))),
"select Col1 where Col1 is not null and Col1 <>'720th STG Flights'")

Resources