Vlookup Formula Issue - excel

Hi Everyone, Please have a look on Cell D2. I have tried the Formula
=VLOOKUP(B2,$B$8:$D$12,3)
But it doesn't give the Result i.e. I require 04 Values as I have written there Manually but it's giving only 01 Value. I think an Array Formula might work but don't know.

VLOOKUP will not work as it will only return one answer.
You will want TEXTJOIN as an array formula
=TEXTJOIN(CHAR(10),TRUE,IF($B$8:$B$12 = B2,$D$8:$D$12,""))
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
TEXTJOIN was introduced with Office 365 Excel.
If you do not have Office 365 Excel and still want the values in one cell like your example you will need vba.

Related

How to extract & add all the nos. from brackets in excel when there are such multiple instances

I am stuck with a data in excel having the above form and wish to add all the numbers between brackets and finally give its addition after applying the formula.
For ex. abc(200), def(300), gijklmno(5000), pqrstuvwx yz(50000) should give 55500 in another cell
Trying: abc(200), def(300), gijklmno(5000), pqrstuvwx yz(50000)
Expecting: 55500
Alternative:
=SUM(0+INDEX(TEXTSPLIT(A1,"(",")",,,0),,2))
In case you don't have the newest functions, you could use something like:
=SUMPRODUCT(FILTERXML("<a><b>"&SUBSTITUTE(SUBSTITUTE(A1,")","("),"(","</b><b>")&"</b></a>","//b[number()=.]"))
which should work in 2013 or later, I think.
You can try using a formula like shown below,
• Formula used in cell B1
=SUM(--BYCOL(TEXTSPLIT(A1,","),LAMBDA(x,TEXTBEFORE(TEXTAFTER(x,"("),")"))))
Alternative approach since you have not mentioned your Excel Version, the below formula works with Excel Windows 2010+ & MAC
• Formula used in cell B1
=SUMPRODUCT(IFERROR(--TRIM(MID(
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"(",")"),")",","),",",REPT(" ",100)),
COLUMN($A$1:$Z$1)*100-99,99)),0))
Note: Depending on one's Excel version this needs to be keyed with CTRL+SHIFT+ENTER instead of Enter when exiting edit mode.

Excel formula to lookup a table from another table with comma separated output

I am trying to get a formula that looks up information from another table and populates the output with comma separated values. As shown below, I want to populate column D in Table 2 with information from Table 1. The desired output is in column E. I came up with this formula but it's only pulling one city per person.
TEXTJOIN(", ",,INDEX('Table 1'!B:B,MATCH(FILTERXML(""&SUBSTITUTE(C3,",","")&"","//m"),'Table 1'!A:A,0)))
For you reference, you can see the screenshot below,
Solution as posted by Scott Craner Sir using FILTERXML()
• Formula used in cell G8
=TEXTJOIN(", ",,FILTER($B$3:$B$9,ISNUMBER(MATCH($A$3:$A$9,FILTERXML("<m><b>"&SUBSTITUTE(F3,", ","</b><b>")&"</b></m>","//b"),0)),""))
Note: Depending on one's Excel version this may needs to be keyed with CTRL+SHIFT+ENTER instead of Enter when exiting edit mode.
Perhaps, if you are using MS365 then you can use ARRAYTOTEXT() with TEXTSPLIT() as well,
• Formula used in cell G3
=ARRAYTOTEXT(FILTER($B$3:$B$9,ISNUMBER(MATCH($A$3:$A$9,TEXTSPLIT(F3,,", ",1),0)),""))
Kindly change the cell range/sheet preferences as per your suit.
Edit
Thanks! It appears to be working now. However, there is one down side that I am hoping you can help with. If there is only one person listed, it's returning a #calc error. This formula only appear to be working when there are multiple staff present. Any idea on how to fix this?
• Formula used in cell G8
=TEXTJOIN(", ",,FILTER(B:B,ISNUMBER(MATCH(A:A,FILTERXML("<m><b>"&SUBSTITUTE(F8&", ",", ","</b><b>")&"</b></m>","//b"),0))))
Or,
• Formula used in cell G3
=ARRAYTOTEXT(FILTER($B:$B,ISNUMBER(MATCH($A:$A,TEXTSPLIT(F3&", ",,", ",1),0)),""))
Try:
Formula in D3:
=TEXTJOIN(", ",,IF(ISNUMBER(XMATCH("*, "&A$3:A$9&", *",", "&C3&", ",2)),B$3:B$9,""))
Note I concatenated leading/trailing comma/space's to prevent possible false positives.
Also, in case you wish to avoid duplicates, just nest UNIQUE() in there:
=TEXTJOIN(", ",,UNIQUE(IF(ISNUMBER(XMATCH("*, "&A$3:A$9&", *",", "&C3&", ",2)),B$3:B$9,"")))

Array formula not calculating on Excel MAC 2020

I have an issue with my Mac to enter an array formula.
I detail what I did so far.
I choose the output cells of the formula
Write the formula
press CMD+SHIFT+RETURN
It does not transform the formula into an array formula with the brackets {},
It only makes a line break on my formula. I tried pressing F2 upfront CMD+SHIFT+RETURN but it doesn't work neither.
Can you help me with this one ?
I've seen there are many people having the same issue on Excel Mac 2020, but didn't find any solution so far.
Best

Excel formula in sorting delimited numbers in a single cell

Im new in excel formulas. I need an excel formula that can sort delimited numbers in a single cell.
Note: I have different lengths of values per cell.
I.g.
349|2|4|11|1|2
Outcome:
1|2|2|4|11|349
Im thinking of reverse concatenating it first then sort it then concatenate it again. But i can't figure it out how to make a working formula for that. Hope someone can help me. Thanks.
This formula solution worked in cell contains numeric value only.
The formula using Textjoin and Filterxml function of which Textjoin available in Office 365 and Excel 2019, and Filterxml available in Excel 2013 and later Excel version
Assume your data housed in A1
In B1, enter array formula (Confirm by pressing Shift + Ctrl + Enter) :
=TEXTJOIN("|",1,IFERROR(1/(1/SMALL(FILTERXML("<a><b>"&SUBSTITUTE(A1,"|","</b><b>")&"</b></a>","//b"),ROW($1:$99))),""))

Extract multiple strings from the same cell using Formulas

I have contents of one excel cell as: for example
Bananas_05/05/2019
Oranges_07/06/2019
Oranges_08/05/2019
Apples_10/12/2018
Oranges_08/03/2019
I want, using formulas only (no VBA) to extract all the dates next to "Oranges_" So I want the output to be:
07/06/2019
08/05/2019
08/03/2019
My current formula can extract only 1 of them, not all
I have no idea what I can try
This is what I have:
DATEVALUE(MID(D20,FIND("Oranges_",D20)+LEN("Oranges_")+1,10))
This is only possible if one has TEXTJOIN() which was introduced with OFFICE 365 Excel.
If one has TEXTJOIN() then this array form will iterate each line and test then concatenate the dates.
=TEXTJOIN(CHAR(10),TRUE,IF(ISNUMBER(SEARCH("Oranges_",TRIM(MID(SUBSTITUTE(A1,CHAR(10),REPT(" ",999)),ROW($XFD$1:INDEX($XFD:$XFD,LEN(A1)-LEN(SUBSTITUTE(A1,CHAR(10),""))+1))*999+1,999)))),SUBSTITUTE(TRIM(MID(SUBSTITUTE(A1,CHAR(10),REPT(" ",999)),ROW($XFD$1:INDEX($XFD:$XFD,LEN(A1)-LEN(SUBSTITUTE(A1,CHAR(10),""))+1))*999+1,999)),"Oranges_",""),""))
Being an Array Formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.

Resources