I am trying to match specific name (the names may be repeated several times) and to look up the name which has the lowest value in column D
Here's a snapshot to illustrate the issue
I would like for example to lookup the name Name1 and return the one who has the lowest value. In this case I need to return the row number 4 as this one has only 12 in value
I tried such a formula but didn't work for me
=MATCH("Name2",$A$2:$A$9,MATCH(MIN($D$2:$D$9),$D$2:$D$9,0))
You may use:
=MATCH(1,(A1:A9="Name1")*(D1:D9=MIN(IF(A1:A9="Name1",D1:D9))),0)
Note: It's an array entered formula using CtrlShiftEnter.
If you have Office 365, you can use the new XMatch function with an array returned by an IF statement. Like this formula, which assumes that the text "Name1" is in cell F1.
=XMATCH(0,IF(A1:A9=F1,D1:D9,NA()),1,1)
edit after comment: If you can't use Xmatch, then the data needs to be sorted by column D values from large to small. Then you can use Match() with a -1 as the last argument to look up the next value larger than 0. XMatch can do that with unsorted data, but Match needs sorted data for that.
Also, if you don't use Office 365, the formula needs to be confirmed with Ctrl + Shift + Enter, because it is an array formula. If you enter it in Office 365 Excel, that's not needed, but if people edit the workbook with an older version of Excel and edit the formula, they need to use Ctrl + Shift + Enter.
Related
If number from first coulmn is found in the second column, it should return that number.
If number from first coulmn is not found in the secound column, it should return closest possible min value
You can use vlookup() like this, BUT you need to sort the values:
In C1 enter the array formula:
=MAX(IF(B:B<=A1,B:B))
and copy downward:
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.
NOTE:
Sorting is not required.
Array entry is not required if you are using Excel 365.
Another option is SUMPRODUCT:
=SUMPRODUCT(MAX(--($B$1:$B$12<=A1)*$B$1:$B$12))
It works on Excel 2007 or higher, no need of array entered formula and no need of sorting.
I'm trying to find in a list the lowest unique value.
I tried to find out a way on google, but nothing seem to work like I want.
What i have :
John;5
Leon;7
Mark;5
Bob;3
Peter;3
Louis:4
Desired result: "4" because it's the lower unique value.
Suppose I add in the original list:
Alex;4
The new result is about to be "7" because it's the new lowest unique value.
my excel sheet :
Assuming your data is setup so that names are in column A and values are in column B so that it looks like this:
In cell D2 (or wherever you want the result), use this array formula (Note that array formulas must be confirmed with CTRLSHIFTENTER and not just ENTER):
=MIN(IF(COUNTIF(B2:B20,B2:B20)=1,B2:B20))
You'll know you've entered it as an array formula correctly because you'll see it surrounded by curly braces {=formula}in the formula bar. Do NOT add the curly braces manually.
You'll also notice that I have extra rows in there than just the used rows. Normally I'd suggest using a dynamic named range, but this works for now. So when you add the new line of Alex; 4, you get this:
And you can see the formula now has the new correct value of 7.
With data in columns A and B, in C1 enter:
=COUNTIF(B:B,B1)
and copy down. Then in another cell enter the array formula:
=MIN(IF(C:C=1,B:B))
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key.
To avoid speed problems, make the limits on the ranges as small as possible:
=MIN(IF(C1:C6=1,B1:B6))
I would like excel to display the value from table array which has two matching cells com_cd and div_cd using INDEX and MATCH.
I have tried the following formula but it did not work.
=INDEX(K9:K53,MATCH(K3,I9:I53,0),MATCH(K4,J9:J53,0))
Here is a screenshot of the excel sheet with the desired result given according to com_cd and div_cd
Try an array formula (CTRL + SHIFT + ENTER) instead of Enter.
=INDEX(K9:K53,MATCH(K3&K4,I9:I53&J9:J53,0),1)
Not tested but should work.
Will edit later explaining our formula and reason why your formula doesn't work.
Your column_num parameter on the INDEX function cannot sinply provide a secondary row criteria. You need a way to ensure a two column match on the row_num parameter and leave the column_num either blank or as 1 (there is only only column in K9:K53).
The standard formula for K5 should be,
=index(K9:K53, aggregate(15, 6, row(1:45)/((i9:i53=k3)*(j9:j53=k4)), 1))
... or,
=index(K9:K53, min(index(row(1:45)+((i9:i53<>k3)+(j9:j53<>k4))*1e99, , )))
The cell range K9:K53 has a total of 45 rows. The position within K9:K53 will be within ROW(1:45). The first formula forces any non-matching row into an #DIV/0! error state and the AGGREGATE¹ function uses option 6 to ignore errors while retrieving the smallest valid entry with the SMALL sub-function (e.g. 15). The second formula performs the same action by adding 1E+99 (a 1 followed by 99 zeroes) to any non-matching row and taking the smallest matching row with the MIN function.
¹ The AGGREGATE function was introduced with Excel 2010. It is not available in earlier versions.
I currently have this:
=SUMPRODUCT(SUMIF(A:A;Index(List;;1);B:B))
Column A is a list of names, column B is a list of values for each names. The named range List has 2 columns, the first one are names and the second one are boolean values (0 or 1).
My formula actually works to return the sum of every column B values of its corresponding name in the A column IF that name is in the first column of my named range List. It works fine.
However, I would like to filter that to only include names from List that have the boolean value equal to 1 (ie. Index(List;;2) = 1.
How is this possible?
This is what I tried but it gives me a #REF! error:
=SUMPRODUCT(SUMIF(A:A;Index(List;;1)*Index(List;;2);B:B))
Probably best to switch to an array formula**:
=SUM(SUMIF(A:A,IF(INDEX(List,,2),INDEX(List,,1)),B:B))
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
Since your Named Range consists of discontinous ranges, when INDEXing it you will need to include INDEX's 4th parameter (area_num) in order to clarify which of the ranges ($B$2:$B$100 or $L$2:$W$100) you wish to refer to, e.g.:
=INDEX(List,60,1,**2**)
which will return the value in cell L61.
Regards
I use the following formula =INDEX(Dict!A:A,MATCH(A2,Dict!A:A,0),1) but MATCH only works with text below 256 characters. Any way to overcome this limitiation?
To accommodate partial matches use SEARCH like this:
=INDEX(Dict!A:A,MATCH(TRUE,INDEX(ISNUMBER(SEARCH(A2,Dict!A:A)),0),0))
That will work to return a value > 256 characters but A2 can't be > 256 characters
You can use the LDMP look-up method, taking advantage of the concat formula available since the Excel 2016.
={CONCAT(IF(Value=A:A;B:B;"")}
Note that it is a matrix formula so you must enter it CTRL + SHIFT + ENTER.
Additionally the formula returns not only the first value but all the matching values.
There is another way to do this, if you don't mind the messiness of a helper column, and your original formula is not being repeated in subsequent rows (i.e. matching cells A3, A4, A5...). The helper column can of course be hidden to keep DICT looking pretty.
Insert (or use) a column (say B:B) next to A:A in DICT!, and populate it with a simple formula "=A1=SHEET1!A$2" (SHEET1 being the name of your source/original sheet), which will populate the column with TRUE and FALSE values, indicating which rows (if any) in DICT match to A2.
The match syntax then changes from "MATCH(A2,Dict!A:A,0)" to "MATCH(TRUE,Dict!B:B,0)".
Note: I know this works in principle as I have just done it, but if I added a typo in retrofitting it to the example provided, apologies, however the principle should be easy to follow.