I have a workbook with sheets s1 and s2. For a given value in column U of s1, I want to determine whether or not it exists in column G of s2 using INDEX(MATCH()). I'm not using VLOOKUP because I'm actually trying to do a multiple-criteria lookup, and I'm following the approach described here; this is just the simplest case with a single-criterion lookup.
When I use the formula:
=INDEX('S2'!A1:Q2945,MATCH(1,'S2'!G1:G2945='S1'!U4,0),2)
I get an #N/A error of "Value not Available".
But when I use either of the following formulas:
=VLOOKUP('S1'!U4,'S2'!G1:G2945,1,FALSE)
=INDEX('S2'!A1:Q2945,MATCH('S1'!U4,'S2'!G1:G2945,0),2)
then the lookup is successful.
I've verified that the values match by copying the value of U4 from S1 and searching for it on S2.
Why am I getting the "Value not Available" error from the first formula?
Written as an answer to close out this question, the MATCH() function in your equation is specifying more than an array as its second argument.
Your existing formula:
=INDEX('S2'!A1:Q2945,MATCH(1,'S2'!G1:G2945='S1'!U4,0),2)
... should be corrected to the following (with "='S1'!U4" removed):
=INDEX('S2'!A1:Q2945,MATCH(1,'S2'!G1:G2945,0),2)
Hope this helps.
Cheers!
Related
I am attempting to help a student with a really simple formula and am having trouble understanding the context of the solution.
We start with a small list of values in columns A & B and another list of addresses in column C that point to the values in column A or B:
The goal is to retrieve the items in column A or B in the order specified in column C.
Her first attempt was to use:
=INDIRECT(C1:C5)
Since we are using Excel 365, this produced a dynamic spill-down of #VALUE! errors. I explained that this is because the INDIRECT() worksheet function cannot accept an array input and if we use a string input like =INDIRECT("C1:C5") all we get is the address pointers rather than the values themselves.
I suggested =IF(ROWS($1:1)<=COUNTA(C:C),INDIRECT(C1),"") and copying downward manually. She left and returned later to tell me that they found a way to make INDIRECT() work with an array input:
=SUMIF(INDIRECT(C1:C5),"<>")
which DOES work! What we don't understand is:
Why does enclosing a non-working formula in SUMIF() make it work
Why SUMIF() is returning an array rather than a single value
Any explanations or references will be appreciated.
I am looking to flag all line items in "array B" where a flag is assigned if there is a partial match in "array A". I would like to make the "flag" that is returned the cell found in "array A".
I am wondering whether or not Index Matching with a Wild Card reference is the correct way to accomplish this. I am pretty new to Excel formulas.
Please see below what I have already accomplished.
I have already tried multiple equations found on Stack Overflow, but they do not seem to address my issue. Please see below for the equation that I am trying to use.
view the screenshot of my file here:
Here is the formula I am trying to use =INDEX(B$1:B$9998,MATCH("*"&G2&"*",A$1:A$9999,0))
I expected the contents of the "flag" column to return but instead, the equation returns value #N/A
EDIT: I have included a simpler data set to use as an example below
View Simpler Data Set Here - Cant Post Images Yet - Edit to include if you can, thanks!
Thanks for your additional explanation. If you want to match the Variation Sku (column G) with the Master Sku (column A), I assume that you want to use wildcards because some of your variations (e.g. BER-92-MP-002) might slightly differ from column A (e.g. "xxxBER-92-MP-002xxx"), that is why you wanted to look for:
"*"&"BER-92-MP-002"&"*"
Assuming this is correct, then you can use an Array formula to look for the Row number where the match occurs, e.g. cell E2 (Ctrl+Shift+Enter):
=MAX(IFERROR(IF(FIND(G2,$A$2:$A$9),ROW($A$2:$A$9)),0))
Then your Flag can be retrieved as follows (cell F2):
=IF(E2,INDEX($B$1:$B$9,E2))
Screenshot with the final result:
I hope it helps & apologies if I misunderstood your original request. Happy to adjust both formulas if necessary (you can post additional screenshots by editing your original post).
Adjusted:
Assuming that your search string always starts with "SKU" and is followed by "-" symbol and one additional string (e.g. SKU-BLUE), you can use the following formula in cell F2:
=IFERROR(MATCH(MID(H2,FIND("SKU-",H2),FIND("-",MID(H2,FIND("SKU-",H2),100),5)-1),$A$1:$A$5,0),0)
Formulas in column G are the same as in my previous post. Final result:
I am trying to write a formula that checks the status and name to be ongoing and joe blogs (in this example), and once finding a match, will identify the oldest date of a ticket raised.
My formula currently includes:
=MIN(IF('Sheet2'!AA:AA="ONGOING",IF('Sheet2'!Q:Q="Joe Bloggs",'Sheet2'!B18:B49)))
I also tried:
=IF((AND(sheet2!$AA:$AA="ongoing", 'Sheet2'!$Q:$Q="Joe Bloggs")), MIN('Sheet2'!B18:B49),"No")
In Column B contains dates. Q contains names, AA contains the status.
At the moment when this runs I get the result '00/01/1990'.
I have done some checks to find the error, and appears to be around the targets name, as when the second formula is tried, the output is "no". The name is definitely in the Q column, and I have completed other formulas including countifs which have worked perfectly fine.
I have done a lot of searching to find nested ifs and min statements to have no joy , would be grateful of any advice / tips. It may be a simple error to some.
Try entering this as an array formula:
=MIN(IF(sheet2!AA:AA="ongoing",IF(sheet2!q:q="Joe Bloggs",sheet2!B:B)))
FYI I found the solution here.
You will have to apply a date format to the result.
Your first formula works well on my data (as below). If I close the formula with ENTER only, I get the result '37128' and if I close the formula with CTRL+SHIFT+ENTER I get the expected result, '25/08/2001'.
Edit: As #FocusWiz said in the comments, the only major difference (other than different column names) between my formula and yours is the the last range in your formula (B18:B49) is a different sized range to the other two, which are referring to full columns.
*This could be solved either by using the same row range for all three column references (AA18:AA49, Q18:Q49, B18:B49) or referencing the full column range for all three ranges (AA:AA,Q:Q,B:B).
This is your formula I'm talking about:
=MIN(IF('Sheet2'!AA:AA="ONGOING",IF('Sheet2'!Q:Q="Joe Bloggs",'Sheet2'!B18:B49)))
And this is the formula in my workbook F7:
=MIN(IF(B:B="ONGOING",IF(A:A="Joe Bloggs",C:C)))
As you can see in the formula editor, squiggly brackets '{}' show around the formula when it has been closed as an array formula.
If that doesn't work for you, please post some sample data with datatypes so we can help figure out what is causing the lookup value to miss the data.
While I like the technique offered by Patrick (I have frequently forgotten an "else" portion of a formula and gotten "false" as a value in a cell but never thought of a use for that...thank you!), I think this question highlights an issue we all can have with array formulas. As girlvsdata indicates, your original formula:
=MIN(IF(Sheet2!AA:AA="ONGOING",IF(Sheet2!Q:Q="Joe Bloggs",Sheet2!B:B)))
(modified above to be more generic for column B) will also work when entered as an array formula.
What likely happened is that somehow the formula got edited and was not re-entered as an array formula.
While I do not dislike array formulas, I do try to avoid them because I have fat fingers and will frequently mess them up by accidentally hitting the wrong key as I am modifying other cells.
Here is an alternative without using an array formula:
=INDEX(LARGE((Sheet2!Q:Q&Sheet2!AA:AA="Joe bloggs"&"ongoing")*(Sheet2!B:B),COUNTIFS(Sheet2!Q:Q,"Joe Bloggs",Sheet2!AA:AA,"ongoing")),1)
What it does is basically create a candidate date value for every row that has "joe bloggs" and "ongoing" which is equal to the date in column B for all such rows. All other rows get a zero candidate date value. The LARGE function takes the smallest nonzero date by counting the n valid candidates with the COUNTIFS function and taking the nth largest such candidate.
I am using the following formula to grab a number from each PivotTable and sum the result.
=SUM(Index(A1,Match(D1,G1:G50,0)),(Index(W1,Match(Y1,Z1:Z50,0))
The formula is then copied down to match the name in A1 down to A100. The problem is that in some cases there is a match for the name for only one of the two PivotTables, and the result isn't calculated. In cases where the name is found in both PivotTables, it calculates without a problem.
How do I specify that if there is no match it should just treat it as a zero and continue on?
The question is answered through comments, hence porting the answer here behalf of Demetri
Note: Additionally added cell freeze option in formula by using "$"
Use the below function to worn on it.
=SUM(IFERROR(Index($A1,Match(D$1,$G$1:$G$50,0)),0),IFERROR(Index($W1,Match(Y$1,$Z$1:$Z$50,0)),0))
I'm trying to make a cell in excel check all of the cells in a column for a certain group of numbers and then display a value based on those cells. Is there any way I can do this?
EDIT: Here's a simplified spreadsheet that shows what I'm trying to do:
(My reputation isn't high enough to post images yet.)
I want to check the cells in column B for "1,4,7,10" Then put the sum of the corresponding C cells into E2.
Could you show us an example and let us know what you've tried? I'm not sure what you are wanting exactly. But based off what you asked:
Try the find(find_text, within_text, start_num) function. Copy and paste that down the entire column and you should get the results out to the side. For example:
A B
1 ABC =if(iserr(find("A", A1)), "NOT found", "FOUND")
2 XYZ =if(iserr(find("A", A2)), "NOT found", "FOUND")
Would give (in B1, B2)
FOUND
NOT found
You could also use
if(iserr(find(...)), 0, 1)
At the end of your column you could do a =sum() and you'd get the number of rows that contain the string you are looking for.
Assuming you're using a full-match on the string 1,4,7,10 you can probably use SUMPRODUCT
E2 = =SUMPRODUCT(--($B$2:$B$6="1,4,7,10"),--($C$2:$C$6))
It worked for my example, but I might have gotten it wrong!
Cant really explain whats going on in the formula, but if you evaluate it in excel and watch how it calculates it you should get an idea!