Matching Pairs Problem in excel using basic functions - excel

May I know how to check whether the Current Pairs match with the Ideal Pairs by using excel functions?
For example: The Current Pair of 1&8 does not match with the Ideal Pair of 1&14 and 1&29
I would also like to count the total number of matching pairs at the end. I have tried out different methods by using countifs() or match(), but in vain.
Appreciate your answer!

You can try below formula to count all matching pairs.
=SUM(--(IFERROR(XMATCH(B2:B7&C2:C7,F2:F7&G2:G7,0),0)>0))

Related

How to extract unique values from an array EXCEPT specified values?

I am already abel to extract unique values, in excel, from an array using this function:
{=INDEX(list,MATCH(0,COUNTIF(uniques,list),0))}
However, I want to specify certain values for excel not to return. Is there any way to specify values that I don't want to be found within the already specified "list"? The ideal outome would be something like this:
I am also using excel version 2101.
Any information is helpful, thanks!
From your example, I ASSUME you want to exclude the lines starting with Round.
Try:
=LET(x,UNIQUE(List),FILTER(x,LEFT(x,5)<>"Round"))
or
=UNIQUE(FILTER(List,(LEFT(List,5)<>"Round")))
I'm not sure if it is more efficient to filter a smaller list, as is done in the first formula; or to avoid using LET as is done in the second formula.
EDIT
This can also be done using FILTERXML and TEXTJOIN which should be present in all Windows versions 2016+
=FILTERXML("<t><s>"&TEXTJOIN("</s><s>",,list)&"</s></t>","//s[not(starts-with(.,'Round')) and not(preceding-sibling::*=.)]")
the xPath
not(starts-with(.,'Round')) : should be obvious
Return only unique values:
and not(preceding-sibling::*=.) : do not return a node if any preceding-sibling matches the current node being tested

Can I use MINIFS or INDEX/MATCH on two non-contiguous ranges...?

Problem is straightforward, but solution is escaping. Hopefully some master here can provide insight.
I have a big data grid with prices. Those prices are ordered by location (rows) and business name (cols). I need to match the location/row by looking at two criteria (location name and a second column). Once the matching row is found (there will always be a match), I need to get the minimum/lowest price from two ranges within the grid.
The last point is the real challenge. Unlike a normal INDEX or MINIFS scenario, the columns I need to MIN aren't contiguous... for example, I need to know what the MIN value is between I4:J1331 and Q4:U1331. It's not an intersection, it's a contiguous set of values across two different arrays.
You're probably saying "hey, why don't you just reorder your table to make them contiguous"... not an option. I have a lot of data, and this spreadsheet is used for a bunch of other stuff. So, I have to work with the format I have, and that means figuring out how to do a lookup/min across multiple non-contiguous ranges. My latest attempt:
=MINIFS(AND($I$4:$J$1331,$K$4:$P$1331),$B$4:$B$1331,$A2,$E$4:$E$1331,$B2)
Didn't work, but it should make it more clear what I'm trying to do. There has GOT to be an easy way to just tell excel "use these two ranges instead of one".
Thanks,
Rick
Figured it out. For anyone else who's interested, there doesn't seem to be any easy way to just "AND" arrays together for a search (Hello MS, backlog please). So, what I did instead was to just create multiple INDEX/MATCH arrays inside of a MIN function and take the result. Like this:
MIN((INDEX/MATCH ARRAY 1),(INDEX/MATCH ARRAY 2))
They both have identical criteria, the only difference is the set of arrays being indexed in each function. That basically gives me this:
MIN((match array),(match array))
And Min can then pull the lowest value from either.
Not as elegant as I'd like... lots of redundant code, but at least it works.
-rt

Better way to Vlookup

I would like to know if there is a better alternative to Vlookup to find matches between two cells (or Python Dfs).
Say I have the below Dfs,
I want my code to check if the values in DF1 was in DF2, If values exactly match OR if the values partially matche return me the value in the DF2.
Just like the matches in 4th column Row 2,3 returned values.
Thanks Amigo!
Well, as you probably suspected already, you have several options. You can easily search for an exact match, like this.
=VLOOKUP(value,data,column,FALSE)
Here is an example.
https://www.excelfunctions.net/vlookup-example-exact-match.html
Or, consider doing a partial match, as such.
=VLOOKUP(value&"*",data,column,FALSE)
Here is an example.
https://exceljet.net/formula/partial-match-with-vlookup
Oh, you can do a fuzzy match as well. Use the AddIn below for this kind of task.
https://www.microsoft.com/en-us/download/details.aspx?id=15011
In Python, it would be done like this.
matches = []
for c in checklist:
if c in words:
matches.append(c)
Obviously, the items in the square brackets are the items in the list.
For Python fuzzy matches, follow the steps outlined in the link below.
https://marcobonzanini.com/2015/02/25/fuzzy-string-matching-in-python/

Multiple arrays within multiple arrays

I have multiple lookup values that I am trying to match across multiple arrays. I would like to match one of those lookup values across several arrays within the same match but I keep getting "#VALUE" or "#N/A".
Current formula I try to use is below simplified for ease of reading.
=INDEX($I$2:$I$10,MATCH(A2&B2&C2,$D$2:$D$10&OR($E$2:$E$10,$F$2:$F$10)&$G$2:$G$10,0))
In this case, I am trying to match B2 either in $E$2:$E$10 or $F$2:$F$10. What am I doing wrong?
Thanks in advance!
At first: You misinterpret the OR function. OR needs boolean values as parameters. And it will not return arrays of values, even not boolean values. It will return either TRUE or FALSE.
At second: Even if OR would work as you seem to think, MATCH needs an one dimensional lookup_array, a row vector or a column vector. It can't work with two dimensional matrices like {$D$2&$E$2&$G$2 , $D$2&$F$2&$G$2 ; $D$3&$E$3&$G$3 , $D$3&$F$3&$G$3 ; ...}
So simplest solution with your example would be to have one INDEX MATCH combination each possible lookup_array:
{=IFERROR(INDEX($I$2:$I$10,MATCH(A2&B2&C2,$D$2:$D$10&$E$2:$E$10&$G$2:$G$10,0)),INDEX($I$2:$I$10,MATCH(A2&B2&C2,$D$2:$D$10&$F$2:$F$10&$G$2:$G$10,0)))}
Or, if you really need this the way you seem to think your formula should work, then you can't use MATCH and need calculate the row number on other way. For example like so:
{=INDEX($I$2:$I$10,MIN(IF(A2&B2&C2=$D$2:$D$10&T(OFFSET($E$2,ROW($2:$10)-2,{0,1}))&$G$2:$G$10,ROW($2:$10)-1,ROWS($D$2:$D$10)+1)))}
The T is used assuming the values in A2:G10 are text values. If they are numeric, N must be used instead.

SumProduct Using Multiple Criteria Returning Too Much Data

Although this question has been asked and answered, (Stack Overflow is where I learned how to implement SP), an issue has come up which I can't figure out.
I'm using SP to sum shipments within a pivot table using a product number (with wild-cards), and a specific date. For instance, part numbers can be "AX10235-HP", "AX11135-HP", "AX10235-HP2", "AX10235-HPSPARE" or TP10101-IBM. (There are a large variety of numbers.)
So in this case I want to sum the qty shipments of "AX???35-HP". I wish to sum just the first 2 parts in my short list. However, the command used causes all the parts to sum except the *-IBM number; as if there was a wild-card at the end of the number. In other words "AX???35-HP" is the same as "AX???35-HP*". I've tried wrapping the value in quotes but it takes uses the quotes literally so fails.
This is the function
SUMPRODUCT((S_PART_DATA)*(ISNUMBER(SEARCH($A6,S_PART_RANGE))*(S_PART_DATES=T$4)))
S_PART_DATA array of Shipments,
S_PART_RANGE array of list of part numbers,
S_PART_DATES array of Dates shipments were made
It works the way you describe because SEARCH function finds $A6 within other text, hence it may not be an exact match - better to use SUMIFS function like this:
=SUMIFS(S_PART_DATA,S_PART_RANGE,$A6,S_PART_DATES,T$4)
Assuming all named ranges are the same size and A6 contains the value AX???35-HP
If that doesn't work try this version
=SUMPRODUCT(S_PART_DATA*ISNUMBER(SEARCH("^"&$A6&"^","^"&S_PART_RANGE&"^"))*(S_PART_DATES=T$4))
concatenating the ^ values means you will [probably] only get exact matches

Resources