Google Sheets Formula Suggestion - google-sheets

So I have the following case.
I have a list in column A and their values in B.
I have a list in column E and their values in F.
The values of B should come from the data from F.
1)If value from A, lets's say A1, is not equal [case insensitive] to any value from the range from E1:E9999, then the B1 value should be nothing.
2) If value from A, lets's say A2, is equal [case insensitive] to a value from the E column, and that value is E4854, then B2 should be copied from F4854.
Kind Regards

=ARRAYFORMULA(IFERROR(VLOOKUP(A1:A, E:F, 2, 0)))

Related

Google Sheets formula to lookup value for all rows in another sheet by column names and returning value by column name

I have a Sheet1 with data like this:
one
two
three
four
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
I have Sheet2 with data like this:
alpha
value 1
c
k
g
c
For each row in Sheet2, I want to look up Sheet2.A2:A in Sheet1 according to a lookup column name in Sheet1 and returning values from the associated row in Sheet1 by return column name in Sheet1.
So, a few examples:
Lookup Sheet2.A2:A in Sheet1.three and return Sheet1.one
Lookup Sheet2.A2:A in Sheet1.two and return Sheet1.four
The idea is the formula would specify the lookup column name and return column name and I'd just change it for each lookup I need to do.
Imagine the formula was something like:
=ARRAYFORMULA(
SOMEFORMULA(
A2:A, # lookup this value
GETCOLUMN(Sheet1, "three"), # in this column in Sheet1
GETCOLUMN(Sheet1, "one") # and return the value from this column in Sheet1
)
)
So, the expected result is:
alpha
value
c
a
k
i
g
e
c
a
I can use the new Google Sheet formulas they just released -- except named ranges. I feel like there is some clever trick using them, but I can't come up with it.
Give a try on below formula:
=BYROW(A2:INDEX(A2:A,COUNTA(A2:A)),LAMBDA(x,INDEX(Sheet1!A:D,MATCH(x,INDEX(Sheet1!A:D,,MATCH("three",Sheet1!A1:D1,0)),0),MATCH("one",Sheet1!A1:D1,0))))
By XLOOKUP() function.
=BYROW(A2:INDEX(A2:A,COUNTA(A2:A)),LAMBDA(x,XLOOKUP(x,FILTER(Sheet1!A2:D,Sheet1!A1:D1="three"),FILTER(Sheet1!A2:D,Sheet1!A1:D1="one"),"")))
Sample Sheet Link.
Use HLOOKUP to the get the correct column in Sheet1 and XLOOKUP to get the corresponding column A value:
=ARRAYFORMULA(
XLOOKUP(
A2:INDEX(A2:A,COUNTA(A2:A)),
HLOOKUP("three",Sheet1!A1:Z,SEQUENCE(ROWS(Sheet1!A1:Z)),0),
Sheet1!A1:A
)
)

VLookup Displaying Duplicate Values - Google Sheets

I've created a lookup formula to take values from column E, match them with values in column A, and assign the corresponding value found in column C and populate it in column F.
I've checked for duplicates in E and A, but I'm still seeing duplicates in F. It's not because there isn't a match, I've checked that as well.
My formula is:
=LOOKUP(E2, $A$2:$A$121, $C$2:$C$121)
Here is a simplified version of the spreadsheet: https://docs.google.com/spreadsheets/d/1A-S0nHFIUGycaDo7KDPAzWBwRZQmfxkjaMivwGfBh-8/edit?usp=sharing
delete everything in F column and use in F2:
=INDEX(IFNA(VLOOKUP(E2:E, A:C, 3, 0)))

How to use Countif function to count rows that has a specific value in either of column A or B in Google sheet?

I am trying to count the number of rows that has a specific value let say "John" in either Column C or Column D. If the two columns have both the same value, then only one of them is counted.
Here is the example sheet. column C & D has the data.
Column G contains the function countif
https://docs.google.com/spreadsheets/d/1i9I2bhtlHAMWqVqdE7hbkgLRLCCUrfnOMSQcf9Gj4_0/edit#gid=0
Try:
=ArrayFormula(COUNTIF(C5:D12,F5:F7)-COUNTIFS(C5:C12,F5:F7,D5:D12,F5:F7))

Vlookup on partial match

Sample Sheet: https://docs.google.com/spreadsheets/d/16HUbIpN9MfTh5msRl54wMCRddTdKUyST-2XqNsnaPxs/edit?usp=sharing
I need to vlookup on a partial match in the search key. In the attached speed sheet, the search key in column A. If the search key in column A contains the lookup value in column F, the value in column G should be returned in column B.
I would prefer to do it with an array formula because my actual sheet is huge. Your help will be greatly appreciated!
In B2 try
=ArrayFormula(if(len(A2:A), iferror(vlookup(regexextract(A2:A, textjoin("|", 1, F2:F)), F:G, 2, 0)),))
and see if that works?
Regexextract 'extracts' the part of the search key (column A) that matches the vlookup value (column F).
Then, the extracted part is used in Vlookup() to retrieve the value (column G).

Spreadsheet Sorting Function

I want to only grab certain values from a column and put them in another column. Here is a graphic of what we would want the output to be. I am using Google Sheets.
Example of what I am trying to do:
Help of any kind would be appreciated
This is achieved with the filter formula. If in D2 you have
=filter(B2:B, A2:A = "A")
that column will contain the entries from column B where the corresponding column A entry is "A". Similarly for others.
Use query. In D2, E2, F2 put:
=query(A2:B,"select B where B contains 'A'")
=query(A2:B,"select B where B contains 'B'")
=query(A2:B,"select B where B contains 'C'")

Resources