Check cell against multiple others, Output Matches "," Delimited - excel

I have the following Data
SKU Cell (M5)
SKU Check Range(Table 1, Column J2:J8000)
Model Range(F2:F8000)
I need to have the following logic converted to the formula for it
IF SKU = SKU Check, Output all models that match from Model Column
with ", " delimiters for multiple matches
I hope this makes sense
Any help on this would be incredibly appreciated

With Office 365 use:
=TEXTJOIN(", ",TRUE,FILTER(F2:F8000,J2:J8000 = M5,""))
Without O365, vba will be needed. There are many UDF that mimic TEXTJOIN in which one can use an Array IF() to return the correct values. Here is one:
VLOOKUP with multiple criteria returning values in one cell
Or this one that does TEXTJOINIFS:
Merge values of column B based on common values on column A

Related

TEXTJOIN of column with same values of other columns, Table references

On column D i want TEXTJOIN of column C.
delimiter is comma with a space after: ", "
the two conditions that have to be met are: same date in column A, same value in column B
This is a table so I prefer using references of the name of the columns (for example "Date")
any help will be greatly appreciated
=IF($B1<>$B2,IFERROR(TEXTJOIN(",",0,$C2:INDEX($C2:$C$12,MATCH(1,--($B2:$B$12<>$B2),0)-1)),TEXTJOIN(",",0,$C2:$C$12)),"")
The Formula indexes column C from the current row up until it finds a different value in column B (minus 1).
The IFERROR is for the last found in range, because it will not find a value in the range after that value that doesn't match that value anymore. To be entered with ctrl+shift+enter for Excel versions prior to Office 365
You can use TEXTJOIN in conjunction with FILTER.
Something like: =TEXTJOIN(",",1, FILTER($C$2:$C$12, ($B$2:$B$12=B2)*($A$2:$A$12=A2))
Note you can replace the ranges with the named ranges, and that '*' is used as a sort of AND within the FILTER function.
EDIT: to avoid repeating rows, you can wrap the entire function with an IF statement that checks for duplicates. Something like:
=IFERROR(IF(MATCH(
TEXTJOIN(",",1,FILTER($C$2:$C$12,($B$2:$B$12=$B12)*($A$2:$A$12=$A12))),D$1:D11,0)>0,""),
TEXTJOIN(",",1,FILTER($C$2:$C$12,($B$2:$B$12=$B12)*($A$2:$A$12=$A12))))

Remove delimited duplicate values from within an Excel cell

I am trying to figure out how to remove duplicate values from with an Excel cell. My columns have values separated by a semi-colon. For example, in Column A I have these 3 rows with the values below.
3;5;6
2;2;4
9;5;12;12
What I am wanting to do in an adjacent column, call it column B, have a formula that returns:
3;5;6
2;4
9;5;12
What formula or function would I need to use to achieve this?
The following formula can work with some limited conditions:
-using >= excel2019 version.
-all numbers in the strings > 0.
-all numbers in the string are integer.
-the maximum number in the string = 10^6
You can change $1:$10 or $1:$100,..
C2=TEXTJOIN(";",,IF(1=FREQUENCY(IFERROR(MATCH(ROW($1:$10),--TRIM(MID(SUBSTITUTE(B2,",",REPT(" ",LEN(B2))),(ROW(INDIRECT("A1:A" & 1+ LEN(B2)-LEN(SUBSTITUTE(B2,",",""))))-1)*LEN(B2)+1,LEN(B2))),0),1000),IFERROR(MATCH(ROW($1:$10),--TRIM(MID(SUBSTITUTE(B2,",",REPT(" ",LEN(B2))),(ROW(INDIRECT("A1:A" & 1+ LEN(B2)-LEN(SUBSTITUTE(B2,",",""))))-1)*LEN(B2)+1,LEN(B2))),0),1000)),ROW($1:$10),""))
If you have office 365 then you can try below formula and see if it helps you with your requirement.
=TEXTJOIN(";",TRUE,(UNIQUE(FILTERXML("<t><d>"&SUBSTITUTE(A2,";","</d><d>")&"</d></t>","//d"))))
For FILTERXML part, I will recommend going through below link on stackoverflow which creates array of individual elements from base string:
Excel - Extract substring(s) from string using FILTERXML
Rest of the structure is pretty standard which uses UNIQUE to get list of unique items and then we join them back together using TEXTJOIN.
Another Office 365 or Excel 2019 formula solution
In B1, array (CSE) formula copied down :
=TEXTJOIN(";",1,IF(ISNUMBER(FIND(";"&ROW(A$1:A$9999)&";",";"&A1&";")),ROW(A$1:A$9999),""))

Remove values in a cell based on a string part

I have a column in Excel that contains a series of comma delimited values. The number of values in each row is different and the values I'm searching for can be in different positions within the cell. I would like to remove some of those values based on based on a string part.
Example cell:
2006CE3, 2007CE3, 2012CE1, 2012CE3, 2013CE1, 2013CE3, 2014CE2, 2015CE3, 2016CE2, 2019FA, 2020SP
Specifically, remove all values containing "CE". In the example above, I would like to remove 2006CE3, 2007CE3, 2012CE1, 2012CE3, 2013CE1, 2013CE3, 2014CE2, 2015CE3, 2016CE2, and leave 2019FA, 2020SP
To do this with a formula one will need TEXTJOIN:
=TEXTJOIN(", ",TRUE,IF(ISNUMBER(SEARCH("CE",FILTERXML("<z><y>"&SUBSTITUTE(A1,",","</y><y>")&"</y></z>","//y"))),"",TRIM(FILTERXML("<z><y>"&SUBSTITUTE(A1,",","</y><y>")&"</y></z>","//y"))))
Please try this formula solution of which using TEXTJOIN function available for Office 365
In B2, enter formula :
=TEXTJOIN(", ",1,INDEX(FILTERXML("<a><b>"&SUBSTITUTE(A2,", ","</b><b>")&"</b></a>","//b[not(contains(.,'CE'))]"),0))

Vlookup all the values matching the search term instead of just one.

So the following formula returns only the first value from the range. I kinda need all the matching search results indexed instead of just 1.
=Vlookup("*" & B3 & "*",A:A,1,0)
SPREADSHEET LINK
With Google Sheets use Query:
=QUERY(A:A,"select A where A contains """ & B3 &"""")
Since you have the Excel tag use this formula for excel:
=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$2:INDEX(A:A,MATCH("ZZZ",A:A)))/(ISNUMBER(SEARCH($B$3,$A$2:INDEX(A:A,MATCH("ZZZ",A:A))))),ROW(1:1))),"")
Copy/drag it down sufficient for your needs.
Another option is
=FILTER(A2:A, SEARCH(B3, A2:A))
Filters out those values where the string can be found and also supports wildcards within the string or could be extended to match a regular expression instead.
vlookup is designed to always give you one result. Either your query matches then it will return the value, else it will return an error. As you want all the values I would recommend a different approach.
Create a column next to your column (in your case A:A) and fill it with your condition =IF($A1 = ("*" & B3 & "*", 1, 0). This column should be filled with 0 and 1 depending on the content of your column B.
Do whatever you want with the values in column A, and take your newly created column as condition. For example to sum all values in column A that match your condition: =SUMIFS(A:A, B:B, "=1")
I hope this helps to streamline your Excel. If you need further help maybe elaborate on the content of your columns A and B and what you want to achieve with your =vlookup().

Returning multiple column headers values using multiple matching criteria

I am looking for returning multiple column values using multiple matching criteria.
Attached is a screenshot of sample sheet, which have my criteria on cell's B1 & C1.
So basically, when matching 2 criteria (example "Team1" & "low"), it should return columns header (example Name10 & name14) from the header ranger C3:N3.
I have tried a couple of formulas, and is is how far I gone: =INDEX($C$2:$AL$2,SMALL(IF(($A$3:$A$21=$B$1)*($B$3:$B$21=$C$1),ROW($A$3:$A$21)-ROW($A$3)+1),ROW(1:1)))
I am not sure what is missing?
enter image description here
enter image description here
Thanks in advance
Fox
First of all, in your example you point out row 3 and 4 but only one of the specified criteria are matched in this rows: low, because Team4 specifyed in the criteria it's not matched, so i will consider you are looking to match one OR both the criteria specified.
The only way i can imagine for do this with a formula is to use a formula like this
=SE(C3<>0;$C$2&", ";"")&SE(D3<>0;$D$2&", ";"")&SE(E3<>0;$E$2&", ";"")&SE(F3<>0;$F$2&", ";"")&SE(G3<>0;$G$2&", ";"")&SE(H3<>0;$H$2&", ";"")&SE(I3<>0;$I$2&", ";"")&SE(J3<>0;$J$2&", ";"") 'and so on...
where SE() it's function IF() in my language, with this formula in a column on the right of the table (for example col O) you will have a list of the names of that row where the corresponding number is different from 0...expand the formula down for all the rows and then, with a formula like this
=SE(O(A1=A3;B1=B3);O3;"")&SE(O(A1=A4;B1=B4);O4;"")&SE(O(A1=A5;B1=B5);O5;"")&SE(O(A1=A6;B1=B6);O6;"")&SE(O(A1=A7;B1=B7);O7;"") 'and so on...
with the function O() corresponding to OR() you will concatenate the strings (names) of the rows that match one OR both the criteria. If you whant to match both the criteria you should use AND() instead of OR().
The problem of this approach is that the formula becomes very long if you have a lot of names and a lot of rows, and if you add rows you have to modify the formula. Another problem is that if you match the same name more times it will be repeated in the list that the formula outputs...and the list of the names ends with a comma.
In fact, i can't tell that this is a good way for obtain what you need, but it's the only i can imagine only with formulas.
If you should use a macro the problem would be solved better and in a more flexible way, should you?

Resources