I'm currently have trouble with a formula. Essentially, I want a formula that will: 1) Check Column D to see if the returned value is "Yes". 2) If Yes, proceed to execute a LOOKUP formula. Here is the formula I have so far--unfortunately it's not working. Any help would be much appreciated!
=IF(D19<>YES, VLOOKUP(C19,'Workbench Exported List'!A2:A961, 'Workbench Exported List'!B2:B961), "Not Available")
A few issues with your formula as written:
Given that you want the VLOOKUP formula if col D = "Yes", your formula needs to be revised to use = rather than <>.
Text values (such as Yes) need to be enclosed in quotation marks when used in a formula ("Yes").
Your VLOOKUP() syntax is incorrect. You need to use VLOOKUP(value, array, column-number, TRUE/FALSE).
Without seeing your data, I'm assuming you want to look up the value in C19 in col A and return the value from col B. Try: =IF(D19="Yes", VLOOKUP(C19, 'Workbench Exported List'!A2:B961, 2, FALSE), "Not Available").
This will search for an exact match of the value in C19 in column 2 of 'Workbench Exported List'!A2:B961 (col B) if D19 is equal to Yes. If D19 is not equal to Yes, the formula will return Not Available.
Related
my problem is the following:
I need a formula that takes a text value from column A and checks if this value is in column Q. If yes it should return the value of the associated cell in column P.
But i already fail to return the cell address of column Q if it matches.
This is my formula:
=IF(COUNTIF($Q$2:$Q$577;A222);MATCH(A222;$Q$2:$Q$577M;0);" ")
You can use INDEX and MATCH to get this output like Rory suggested
=IFERROR(INDEX($P$2:$P$577;MATCH(A222;$Q$2:$Q$577;0));"")
If you have O365, you can also use Xlookup like this:
=XLOOKUP(A222;$Q$2:$Q$577;$P$2:$P$577)
In this sheet, I have a range in B1:C18, where I want to return column C values in G column where all values match with column B with the condition value in E1.
But I'm getting only top value from the Column C but not all (i.e., Sep 2 has two values 443 and 472) but it is returning only 443.
Could anyone look at the formula return in G1 as
={IF(ISERROR(INDEX($B$1:$C$18,SMALL(IF($B$1:$B$18=$E$1,ROW($B$1:$B$18)),ROW(1:1)),2)),"",
INDEX($B$1:$C$18,SMALL(IF($B$1:$B$18=$E$1,ROW($B$1:$B$18)),ROW(1:1)),2))}.
Get the Answers in a column
Ok, I checked and your formula and it is correct too. I have modified it to be an ArrayFormula in the Google Sheets. Just check.
Formula 1
=ArrayFormula(IF(ISERROR(INDEX($B$1:$C$18,SMALL(IF($B$1:$B$18=$E$1,ROW($B$1:$B$18)),ROW(1:1)),2)),"", INDEX($B$1:$C$18,SMALL(IF($B$1:$B$18=$E$1,ROW($B$1:$B$18)),ROW(1:1)),2)))
You can try this formula too -
Formula 2
=ArrayFormula(IFERROR(INDEX($C$1:$C$18, SMALL(IF(E$1=$B$1:$B$18, ROW($C$1:$C$18),""), ROW())),""))
Just copy the formula in the cells of the respective column and you are good to go.
Get the Answers in a single cell
Use this Array Formula for your Google Sheets -
=ArrayFormula(TEXTJOIN(", ",TRUE,IF(B1:B18 = E1,C1:C18,"")))
It will aggregate all the values in a single cell.
Maybe you can try
=iferror(split(textjoin(", ", 1, filter(C2:C, B2:B=E1)), ", ", 1))
and see if that works ?
Is there an easier and more compact way to write this formula?
[1] [2]
A 0
B 5940
C 13860
D 22500
E 87300
F 378000
=IF(Q27="A",0,IF(Q27="B",5940,IF(Q27="C",13860,IF(Q27="D",22500,IF(Q27="E",87300,IF(Q27="F",378000,"ERROR"))))))
So what it does is return the respective values in [2] if Q27 equals one of the letters in [1].
I managed to get the result I expected but I'd like to know if the code can be improved.
Thanks
That is what VLOOKUP is for. Put your table in A1:B6 then:
=VLOOKUP(Q27,A:B,2,FALSE)
Or you can "Hard Code" the VLOOKUP like this:
=VLOOKUP(Q27,{"A",0;"B",5940;"C",13860;"D",22500;"E",87300;"F",378000},2,FALSE)
Or:
=INDEX({0,5940,13860,22500,87300,378000},MATCH(Q27,{"A","B","C","D","E","F"},0))
If you have to hard-code the values then maybe,
=iferror(choose(code(upper(q27))-64, 0, 5940, 13860, 22500, 87300, 378000), "error")
The following formula:
=INDEX($B$2:$B$7,MATCH(E2,$A$2:$A$7))
Enter the value you're using to look up in cell E2. If you were to put the formula in cell Q27 as you specified, then you would get the return value in that cell. If you were to put D into cell E2, and have the formula in cell Q27, you would get 22500 in Q27.
Alternatively, if the helper cell E2 isn't an option, you could simply replace E2 in the formula with "A", or "B", or whichever specific value you're using to lookup. Be sure to include quotation marks around it. For example:
=INDEX($B$2:$B$7,MATCH("A",$A$2:$A$7))
I have an excel spreadsheet. I need to check if the value in a cell in column A is present in any cell in columns B, C and D.
Here is my current formula:
=AND( NOT(ISNA(VLOOKUP($A2,$B:$B,1,FALSE))), NOT(ISNA(VLOOKUP($A2,$C:$C,1,FALSE))), NOT(ISNA(VLOOKUP($A2,$D:$D,1,FALSE))) )
This formula works, in that if the value in A2 is present in a cell in column B, C, and D it will return true - It returns false if not.
What I'm looking to do is to return the value in A2 when the match is correct.
Thanks in advance.
To solely answer your question, you can just put this around your formula:
= IF(<your formula>,A2)
This returns whatever is in cell A2 if your formula evaluates to TRUE, and returns FALSE otherwise.
More Info, Suggest you Read
You're not really using VLOOKUP for it's intended purpose. VLOOKUP is used when you want to find a match in a table, then return some other value in the table with the same vertical index.
Since you just want to determine if a certain value is in a range or not, VLOOKUP is overkill.
Instead of VLOOKUP inside the IF statement, you should just do this:
= IF(AND(COUNTIF($B:$B,A2),COUNTIF($C:$C,A2),COUNTIF($D:$D,A2)),A2)
This should return the same result but is shorter and more efficient.
I have an excel workbook that I need some help with INDEX and MATCH or any other Formula that can get me my end result.
Here is sheet1:
SIT_ID METER SUSE_CD
10834282 DT0061 B
10834282 AW7931 P
21676286 CQ9635 P
21676286 DP4838 B
21726281 AW7880 P
21726281 DT0032 B
Here is Sheet2:
Site ID B P
10834282
21676286
21726281
Ultimately what I am trying to do is on Sheet2 is put the Meter that = B for the SITEID in the column and then Put the Meter that = P in the Same row.
I have never used Index or Match and I looked it up online but I am confused and hoping someone can help me with the correct formula or point me in the right direction.
Thanks so much!
INDEX first takes a range, then a row number, an optional column number (and an optional area number).
MATCH takes a value to lookup, an array and a mode.
In your problem you can use the following in Sheet2 cell B2:
=INDEX(Sheet1!$B$2:$B$7, MATCH($A2, IF(Sheet1!$C$2:$C$7=B$1,Sheet1!$A$2:$A$7), 0))
This formula is an array formula and will work with Ctrl+Shift+Enter and then you can fill it to the other cells.
I had to use an IF because there're two conditions to check.
EDIT: Use this one if your cell formats are different:
=INDEX(Sheet1!$B$2:$B$7,MATCH($A2*1,IF(Sheet1!$C$2:$C$7=B$1,Sheet1!$A$2:$A$7*1),0))
EDIT2: Adding trimming:
=INDEX(Sheet1!$B$2:$B$7,MATCH($A2*1,IF(TRIM(Sheet1!$C$2:$C$7)=TRIM(B$1),Sheet1!$A$2:$A$7*1),0))
EDIT3: If you're using it on your full data, change the range:
=INDEX(Sheet1!$B:$B,MATCH($A2*1,IF(TRIM(Sheet1!$C:$C)=TRIM(B$1),Sheet1!$A:$A*1),0))
Assuming your Sheet1 looks like this:
And your Sheet2 looks like this:
The formula in Sheet2 cell B2 and copied over and down to cell C4 is:
=INDEX(Sheet1!$B$2:$B$7,MATCH(1,INDEX((Sheet1!$A$2:$A$7=$A2)*(Sheet1!$C$2:$C$7=B$1),),0))
Note that this is a regular formula, so no need for Ctrl+Shift+Enter
A helper column D is added to initial columns.
D2: =$A2 & $C2
Now it's possible to make a simple search of the concatenated SITE_ID and SUSE_CD:
H2: =MATCH($G2&" B";$D$2:$D$8;0)
The result would be a row number (=1 in this case) for the needed string in array $D$2:$D$8.
INDEX shows the value of the cell, found by counting n-th row (defined by MATCH) and m-th column (=2) in array $A2:$A$8 from the upper left cell (A2).
Altogether: =INDEX($A$2:$B$8;MATCH($G2&" B";$D$2:$D$8;0);2)
The easiest way to get around with this is,
to use concatenation operator in the match function.
Don't forget to use Ctrl+Shift+Enter
Use below formula in column B of Sheet 2
{=INDEX(Sheet1!$B:$B,MATCH(Sheet2!$A2&Sheet2!$B$1,Sheet1!$A:$A&Sheet1!$C:$C,0))}
And the below formula in column C of Sheet 2
{=INDEX(Sheet1!$B:$B,MATCH(Sheet2!$A2&Sheet2!$C$1,Sheet1!$A:$A&Sheet1!$C:$C,0))}
And then flash fill the remaining rows.