find second match value in bottom up table (Excel) - excel

In Excel I want to use an array formula that automatically shows the 2nd relative value of a vlookup criteria.
I managed to do this in a top-down list, where I add data on top. But am unable to get this working in a bottom-up list.
I visualized the question for your convenience...
Thanks in advance!

I went a different route than what you did. Type the following array formula into cell F2. (I included a line break for readability.)
=IFERROR(INDIRECT(ADDRESS(LARGE(((A2=A$2:A$11)+0)
*((ROW()>ROW(A$2:A$11))+0)*ROW(A$2:A$11),1),COLUMN($A2)+1)),"-")

Switching SMALLto LARGE did it.
The formula of cell F7 should be:
INDEX($B$1:B6,LARGE(IF($A$1:A6=$A6,ROW($A$1:K6),""),2),1)
More info can be found in Patrick G. Matthews's "Finding the Nth Lookup Value in an Excel List.

Related

Fill-down formula vs array formula vs table formula

Let's say I have the following Excel table:
To create a new column for Full Name, what is the suggested or more common way to do it:
Doing a scalar formula and then clicking to fill-down such as shown here; or
Doing an array formula such as shown here.
Or I suppose converting it into a table object and then applying a row formula such as shown here. Oddly though, it doesn't automatically fill down the column and you have to fill-down such as in step 1.
Are there any guides on what the suggested way to work with this stuff is? I can't find much on the official Excel site. What is the way this is usually done?
Use the Left, Right, and Mid functions that use Search. These are always dynamic.

Excel - How to count the number of distinct texts of a specific date inside a table?

I'm trying to count the number of distinct text from a specific date in a data table.
Data Sample with expect result :
I was able to figure out how to count the distinct element from a range I specify, because I can determine the first and last row containing the date.
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
I have tried to modify my formula so that it determines the cell range by itself but without success.
I searched for an answer, using a combination of CELL and MAXIFS, example below, but Excel does not accept the formula.
=CELL("row",MAXIFS(A2:A15,A2:a15,D2))
I've looked at the INDEX formula, but I can't figure out how to do what I want to do. 😑
Any idea what I'm doing wrong, or what I should be doing instead?
Thanks, I appreciate it!
If you have Office 365 and the new Dynamic Arrays, this sort of formula has become ridiculously easy.
This formula in cell E3:
=COUNTA(UNIQUE(FILTER($B$2:$B$15,$A$2:$A$15=D3)))
Copy down.
You can also generate the unique list of dates with this formula in D3, which spills down automatically and does not need to be copied.
=UNIQUE(A2:A15)
It wasn't easy, but by separating each step of the problem, I was able to solve it.
Note that my solution only works because my dates are sorted.
Here's the final formula in the cell "One formula to rule them all":
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2))),INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)))))
Here are my explanations of my process:
Formula if I select the range :
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
Formula to get the first iteration
=ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2)
Formula to get the last iteration
{=ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)}
Create range from two addresses
=INDIRECT(CONCATENATE(F3,":",G3))
Formula giving me the expect result
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(F3,":",G3)),INDIRECT(CONCATENATE(F3,":",G3))))

EXCEL: How can I check for a keyword in a string, compare it to a range and return the corresponding value in that range?

I need to categorize data: I have a column with the description of the element I'm interested in. I want to check that description for a keyword, then check if that keyword is contained in for example column A of a separate table. If a match is found, I need returned the value in the next column (in this example column B) of the same separate table.
The attached screenshot shows how the data is organized. The column called Column1 is the output I need.
I have actually found a solution, but it involves lots of nesting, I need to force the categories and keywords in the formula and I can't add all the conditions I need; this is the current formula:
=IFERROR(IF(SEARCH("keyword";cellWithDescription);"category";);"OTHER")
And for more categories I repeat the formula instead of "OTHER":
=IFERROR(IF(SEARCH("keyword";cellWithDescription);"category";);IFERROR(IF(SEARCH("keyword2";cellWithDescription2);"category2";);"OTHER"))
which is not ideal, especially with many categories. How can I accomplish the same task with a simpler and more efficient formula, possibly comparing the keyword to values in a table (and not inside the formula itself, as I did now)?
Thanks in advance for your help!
This works for me
=INDEX(category,MATCH(1,--ISNUMBER(SEARCH(keyword,cellWithDescription)),0),1)
enter as array formula, thus ctrl+shift+enter after copying the formula (curly brackets will appear around the formula)

Excel 2016 'MATCH','ISERROR','IF' formulas with result depending from the match; refering to a cell nearby the result

As in title, I'm trying to compare two lists and when a formula hits the match I want it to type the text, but from the cell right next to the found matching cell.
For example: A list of 5343 positions B1:B5343 has corresponding reference numbers in A column (A1:A5343). F1 has a certain number. G1 ought to show the reference number, not the match itself.
I've tried to work with this formula:
=IF(ISERROR(MATCH(F1;$B$1:$B$5343;0));"";A1)
Where A1 should be the reference cell. Not fluent in Excel enough to know
is there a way to refer to a formula result?
is it possible to refer to a cell next to the cell of interest (or few away)? ex.(B-1)54=A54
Not sure how can I clarify the problem more than that :) Help me out please!
Eager to read Your answers! Cheers!
This is a typical case for Vlookup
i would probably go for a index match on this, so INDEX(C:C,MATCH(F1,B:B,0),1)
the index part will go get the cell next to it you want, just replace C:C with the column its in
If its not a match use iferror, rather than iserror as well, Its better practice.
SO : IFERROR( INDEX(C:C,MATCH(F1,B:B,0),1) ,"NO MATCH)
Heres a tutorial

IF statements combining multiple columns

I am using excel 2010 and looking to use IF statements to add multiple columns that have both letters and numbers. I have come as far as to get all the coding in so that when one of each condition is presented they total correctly.
The problem I am having is if there is more than one of the same condition.
For example the IF statement I am using is: =IF(ISNA(MATCH("1P",C7:CO7,0)),0,1)+IF(ISNA(MATCH("2P",C7:CO7,0)),0,2) and so on.
Obviously between cells C7 and CO7 there are many cells and if more than one cell has 1P or 2P in it the additional cells are not being added and only one. How can I get my formula to recognize the condition in more than one cell?
Thanks
=COUNTIF(C7:CO7,"1P")+2*COUNTIF(C7:CO7,"2P") should get you the answer you need
Edit: Fixed formula - thanks #Andy
If you are interested in a flexible approach that allows for an arbitrary number of match values and multipliers, you could try this.
Make a little table somewhere of Match Values and corresponding Multipliers and use this array formula:
=SUM(IF($C$7:$CO$7=$A$2:$A$5,$B$2:$B$5,0))
Commit the array formula by pressing Ctrl+Shift+Enter.
Note my screen shot truncates the data range. 14 is the correct answer for the data I entered.

Resources