Index and Match with Multiple Results and concatenate - excel-formula

Example I have a large amount of data where I usually use an index and match formula.
It always brings the first result. Is it possible if it can bring multiple results from the same column and concatenating the result with a single space?

A possible Solution would be this ARRAY-FORMULA: CTRL + SHIFT + ENTER
=IFERROR(INDEX($B$1:$B$7,SMALL(IF(ISNUMBER(SEARCH($D2,$A$1:$A$7)),ROW($D$1:$D$7)),COLUMNS($E$1:E1))),"")
This formula needs to be pulled downwards and sideways. Multiple results will be listed columnwise.
Concatenating is a bit of a problem in earlier EXCEL versions. If you have Office 2019 or Office 365, you could use Textjoin.

Related

Dynamic sort top/bottom N values in excel 2019

I'm currently using excel 365 but need to make a spreadsheet compatible with 2019. I have a list of unique departments each with a specific volume of production. I need to create a dynamic filter for the bottom 5 producers, along with a vlookup alternative to get the values so I can graph them.
In excel 365 it's as simple as
Departments: =FILTER(Metrics!$B$2:$B$41,Metrics!$AL$2:$AL$41<E22)
Values: =IFERROR(VLOOKUP(D25#,Metrics!$B$2:$AM$41,37,FALSE),"")
The table goes from A1:A41 with row 1 being the headers.
I've tried using MIN and SMALL but can't figure out how to get more than one value. I'm open to but would prefer not to use VBA if I can help it.
For a function using SMALL, you'll have to use it in an array.
To do that, type out your formula, then instead of hitting enter like usual, press 'ctrl + shift + enter' to tell Excel to use an array. This will put {} around your formula to indicate it worked properly. From there just drag your formula down your desired amount of columns and should be good to go.

Excel formula to SUM all numbers in a cell with text

I have cells in my spreadsheet who are like:
RF(4);MN(4);LL(2);TE(4);HA(2)
There is a formula where I can sum all the numbers in that String/Cell?
I can try another way by Office Script, but since he has low speed, and I have to sum a lot of lines of cells with those type of string, i would try to accelerate the process with Excel Formula as much as possible.
best regards
With Excel 2013 and later you can use FILTERXML to pull out the numbers and wrap that in SUMPRODUCT to return the sum:
=SUMPRODUCT(FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(A1,")","</s><s>"),"(","</s><s>")&"</s></t>","//s[number()=.]"))
One note, this does not work in Excel online or the phone/tablet apps. And some versions of mac also do not have FILTERXML.
If they are always single digit we can use:
=SUMPRODUCT(IFERROR(--MID(A1,SEQUENCE(LEN(A1)),1),0))
or older version:
=SUMPRODUCT(IFERROR(--MID(A1,ROW($ZZ$1:INDEX($ZZ:$ZZ,LEN(A1))),1),0))
For some versions this will require the use of Ctrl-Shift-Enter instead of Enter when exiting edit mode to make it an array formula.
What you want to do is delimit the column based on ";"
Data --> Text to Columns --> Delimit / Next --> Semicolon --> Finish
This will separate the column into 5 columns based on the data you gave, now you'll add 5 additional helper columns that will extract the number.
Assuming your new Data goes from A2:E2 and downward, placing this formula in F2:J2 =SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2, ROW(INDIRECT("1:"&LEN(A2))), 1)) * ROW(INDIRECT("1:"&LEN(A2))), 0), ROW(INDIRECT("1:"&LEN(A2))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(A2)))/10)
After dragging this formula across the 5 columns (separating the numbers from text); Add 1 last column summing these 5 new columns.
This should be able to handle multiple digits in a single group of parenthesis. You can avoid having all the additional columns, by adding the formula for each column together. I just break this out so if there's issues you have visibility in what's happening and how it works.

Count most frequent test based on criteria

I am trying to pull back the most frequent country based on a sector.
Here is a brief look at the data
Here is my code:
=INDEX(Transactions!$U$2:$U$318,MODE(IF(B5=Transactions!$S$2:$S$318,MATCH(Transactions!$U$2:$U$318,Transactions!$U$2:$U$318,0))))
Unfortunately, it appears that since there are multiple countries and multiple sectors in excel, the values pulled back in the Match don't line up with the values in the IF (i.e. IF={1,1,8,5}, MATCH={1,1,289,9})
Can anyone help out with this excel code?
Another solution would be: (Confirm with CTRL + SHIFT + ENTER)
=INDEX(B:B, 10000*MOD(MAX(COUNTIFS(A1:A7,C1,B1:B7,B1:B7)+(ROW(B1:B7)/10000)),1), 1)
The formula is based on the one from this site. I just changed COUNTIF to COUNTIFS to account for the criteria.

How to lookup value with multiple criteria in excel 2007 and newer

I would like to lookup for a value in excel table with multiple criteria. I have tried this:
=INDEX($D$2:$D$10,MATCH(1,($B$2:$B$10=A13)*($C$2:$C$10=A13),0))
but it doesn't work.
I use this one:
=LOOKUP(2,1/(Reservation!$A:$A=$A20)/(Reservation!$B:$B=F$5)/(Reservation!$D:$D=0),Reservation!$C:$C)
... which works fine, but it's extremely slow.
Is there anyway to use index with multiple criteria?
Normally with a single criteria all you would have to do is type:
INDEX($D$2:$D$10,MATCH(A13,$B$2:$B$10,0))
And hit enter and you are done.
However, since you are using arrays inside your MATCH formula i.e. ($B$2:$B$10=A13) and ($C$2:$C$10=A13) you need to enter your formula using:
ctrl + shift + enter
If you want further reading you can see Microsoft's Guidelines and examples of array formulas

Sum Filtered Values Excel

I am finding the sum of filtered values while ignoring #DIV/0! errors. As such, I combined the following formulas:
=SUBTOTAL(9,$I$2:$I$349)
and
=SUMIF($I$2:$I$349,"<>#DIV/0!")
To get:
SUBTOTAL(9,SUMIF($I$2:$I$349,"<>#DIV/0!"))
However, excel returns an error. Any insights?
Is it that I cannot place a formula within another formula?
Which version of Excel are you using?
In Excel 2010 and later versions AGGREGATE function works a little bit like SUBTOTAL - it can perform various functions while ignoring hidden rows.......but it also has options to ignore error values, so without any helper columns you can use this single formula
=AGGREGATE(9,7,I2:I349)
9 denotes "sum" as per SUBTOTAL while 7 as the 2nd argument indicates that error values and hidden values should be ignored. There are other options, see Excel Help for more
I found this bit of brilliance with some digging on the webs: http://www.excelbanter.com/showthread.php?p=760730
It's a difficult formula to follow, but should do the trick.
{=SUM(IF(ISNUMBER($I$2:$I$349),$I$2:$I$349)*(SUBTOTAL(3,OFFSET($I$2:$I$349,ROW($I$2:$I$349)-MIN(ROW($I$2:$I$349)),0,1))))}
It's an array formula, so make sure to press Ctrl + Shift + Enter (instead of just Enter).
I can't pretend to understand it all without really digging into it, but it works!
Use a helper column
In H2 enter:
=IFERROR(G2,"")
and copy down and then use:
=SUBTOTAL(9,$H$2:$H$349)
=IFERROR(SUBTOTAL(9,$I$2:$I$349),"")

Resources