I have a sheet that looks similar to this:
Is it possible to create a formula in column B that will create a dropdown with the options from columns D through F and reference the selection in column A to find the values? Thank you!
Understood.
Use a helper column and add the following formula:
=IFERROR(TRANSPOSE(query(C1:F3,"SELECT D,E,F WHERE C = '"&A1&"'")),"")
Then at B1, select "List from a range" in data validation dialog and enter the following in criteria:
=$I$2:$I$14
Link to example: https://docs.google.com/spreadsheets/d/1qAd7WFUjkMBTgxheoLRjG_RHXBplwg_qMSmXAbOsC1s/edit?usp=sharing
-Prior answer-
I would use a helper column.
B1: =TRANSPOSE({C3:F3,C4:F4,C5:F5})
Then simply reference B1:B.
Related
I have an Google sheets file with two sheets. I'm trying to reference one sheet's text based on two cells of criteria using a formula in the other sheet. I have one sheet that looks similar to this -
And another that looks like this -
I would like to put a formula on the second sheet that basically says - look on the first sheet for the values in columns A and B and return me the value in column C. The tricky part is - the values in the second sheet may be inverted or there may be an instance where only one value is present, like in row 1 in the first sheet. Also the formula should only fill in a value if both columns match. All text combinations in both sheets are unique.
Is it possible to do this with text? Thank you for your help!
Try the following
=ArrayFormula((IFERROR(VLOOKUP(R2:R&S2:S,{O2:O&P2:P,Q2:Q},2,0))&
IFERROR(IF((R2:R<>"")*(S2:S<>""),VLOOKUP(R2:R&S2:S,{P2:P&O2:O,Q2:Q},2,0),""))))
(Do adjust locale and ranges according to your needs)
Functions used:
ArrayFormula
IFERROR
IF
VLOOKUP
If you can use two keys concated in the lookup table as a virtual key (i.e. make a key like "CAT|DOG"), then you can use that to look in the secondary table.
If you can't guarantee the sort order of the two keys in the secondary table, you can use the following technique to "sort" the two keys so you can make a single lookup key that's always in one stable order.
Sample Table
A
B
C
D
E
SortedKey
Cat
Dog
TRUE
Cat
Dog
CatDog
Dog
Cat
FALSE
Cat
Dog
CatDog
Formulas
Sample formulas for row #1.
For column C, use formula: =A1<B1
For column D, use formula: =IF(C1=TRUE, A1, B1)
For column E, use formula: =IF(C1=TRUE, B1, A1)
For SortedKey, use formula: =concat(D1, E1)
How to create arrayformula sequence number separated by comma in google spreadsheets
expected results is in column B
A
B
5
1,2,3,4,5
2
1,2
3
1,2,3
How about the following sample formula?
Sample formula:
=JOIN(",",ARRAYFORMULA(ROW(INDIRECT("A1:A"&A1))))
When you use this formula, please put this to a cell "B1" and drag down it.
The flow of this formula is as follows.
Create a1Notation of cells using "A1:A"&A1 using INDIRECT.
Retrieve row numbers from the a1Notation using ROW.
Join the row numbers with , using JOIN.
Result:
Note:
When you want to put all result values using one formula, unfortunately, I couldn't find the formula using the built-in functions. In that case, I would like to propose to a custom function as follows. When you use this, please copy and paste the following script to the script editor of Spreadsheet.
And, please put a formula of =SAMPLE(A1:A) to a cell "B1". By this, the result values are put to the column "B" using the values of column "A".
const SAMPLE = v => v.map(([e]) => e && !isNaN(e) ? [...Array(e)].map((_, i) => i + 1).join(",") : "");
References:
INDIRECT
ROW
JOIN
Custom Functions in Google Sheets
You can use TEXTJOIN() with SEQUENCE() function.
=TEXTJOIN(",",TRUE,SEQUENCE(A1))
You can also use this functions in desktop Excel365
I have a sheet with data, in Sheet1 I have data in column M (Text data value "Done") so now I try to apply Conditional Formatting on my Sheet2 column K2:K if Sheet1 Column M have value "Done".
I tried this formula:
=Search("Done",indirect("Sheet1!M2:M"),0)
also this one:
=search("Done",Sheet1!$M2:$M)
but not working
Assuming that you don't want to highlight the entire column but just on a line-by-line basis, could you try with the following formula :
=INDIRECT("Sheet1!"&CELL("address",M1))="Done"
It worked for me when applying this as a conditional formatting rule in column K of sheet 2 and adding manually-created sample data in column K of sheet 1.
You might also want to check this if you were expecting another behaviour :
Conditional Formatting from another sheet
if your Sheet1 looks like this:
then all you need is:
=INDIRECT("Sheet1!M2:M")="Done"
spreadsheet demo
I'm trying to set up the following formula:
I have an Overview sheet where I want to sum the fields in Column B in Sheet named "Accounting", BUT, only sum the Expenses where Column D of the same row in Sheet Accounting is "Expenses"
I've tried a few different formulas, and none worked. Here's the latest one I tried
=search("Expense",(Accounting!B:B)) SUM(Accounting!B:B)
Can anyone help me?
Thanks!
=SUMIF(Accounting!D:D,"Expenses",Accounting!B:B)
I have two spreadsheets. Each has a column A that has an account number. But each has a different info about that account. The accounts also don't share the same set there maybe some the other doesn't have. What I want to do is check Sheet one column A vs sheet two column A and based on that populate a cell in Sheet 1 with Sheet two column B. Could anybody help me with how I might do this.
My Sheet2 looks like this:
You can use VLOOKUP in Sheet1. This formula would work: =vlookup(A2,Sheet2!A:B,2,0)
You can see it put in the cell C2:
If you don't like the #N/A error you can embrace the formula in IFERROR with the parameter "" which would yield an empty string:
=iferror(vlookup(A2,Sheet2!A:B,2,0),"")