Approximate match of date and exatc match of string in Excel - excel-formula

Is it possible to get the following results using formulas prior to Excel 365?
It's like an index-match combo with two criteria. Argument for Column1 must have an exact match, while for Column2 it must look for the next previous date for the match found in Column1.
I could use an UDF in case this can't be done with regular formulas.

A Tricky Lookup (Old Excel)
Your description is kind of misleading but your screenshot shows that you need an exact match in both columns and then find the previous match for the first column to return the value in the third column.
=IFERROR(LOOKUP(2,1/($A$2:INDEX($A:$A,MATCH(1,($A$2:$A$11=E2)*($B$2:$B$11=F2),0)+ROW($A$2)-2)=E2),$C$2:INDEX($C:$C,MATCH(1,($A$2:$A$11=E2)*($B$2:$B$11=F2),0)+ROW($A$2)-2)),"")

Related

EXCEL VLOOKUP multiple outcomes

How can I retrieve multiple values using vlookup and then transform all those values into columns next to each other?
If you use Office 365 you can use the solution provided by pgSystemTester:
=TRANSPOSE(FILTER(B4:B9,A4:A9=C2))
Where C2 contains the search value,
A4:A9 contains the values to match the search value,
B4:B9 contains the result values.
If an Excel version prior to O365 is used, this could be done by:
=IFERROR(INDEX($B:$B,AGGREGATE(15,6,ROW($A$4:$A$9)/($A$4:$A$9=$C$2),COLUMN(A:A))),"")
This indexes column B with the row numbers where a match is found on the search value C2 in A4:A9. The smallest row number matching is indexed and when copied to the right the 2nd smallest, etc.
Note 1: the INDEX part of the function uses whole column reference.
Note 2: Only in the COLUMN part of the function the $ is omitted in the range reference. This will result in changing the range reference to the right when copied to the right.
You can use the filter function combined with transpose to accomplish what you want.
Here's a sample on google sheets, but it would also work on Excel provided you have Spill-Range functionality...

Is it possible make up Formula in Excel to Find substring in range cells and return the finded cell's value?

is it possible to find substring from second column in first column and insert in third column like that (vlookup doesn't):
Column values
What find
This is found
First
eco
Second
Second
irst
First
Third
eond
Don't find
That would be possible using VLOOKUP. If everything was pasted in Excel as is (with headers) the formula displaying Second would be:
=IFERROR(VLOOKUP("*"&B2&"*";$A$2:$A$4;1;FALSE);"Don't find")
You can drag it down and it will be good for the other ones also, if it doesn't find the value it will create an error which is catched by the IFERROR and thus showing Don't Find instead.
With Excel365, XLOOKUP() would be best case using wildcard character match option to [search_mode] argument.
=XLOOKUP("*"&B2&"*",$A$2:$A$4,$A$2:$A$4,"Don't find",2)
Also INDEX/MATCH() will work for prior version.
=IFERROR(INDEX($A$2:$A$4,MATCH("*"&B2&"*",$A$2:$A$4,0)),"Don't find")

Excel - Retrieving a cell based off of multiple criteria

I am attempting to return the value of a cell from within a different sheet based upon two cell values in the second sheet.
As an example the Main and Second sheet have three columns each (Item, Code, Number), the difference being that the second sheet has only one row and two drop down lists that are populated with the Item(s) and Code(s) (from the Main sheet - i.e like a database table). From within the Second sheet I would like the Number to be returned from the main sheet, once the Item and Code had been selected from the drop down lists on the Second sheet.
Unfortunately I'm unsure as how to do this based off of multiple criteria. As far as I'm aware VLOOKUP only used one criteria over a range. I've attempted the following below which is accepted by Excel as a valid formula, however it doesn't return the correct value.
{=SUMPRODUCT((Main!A:A='Second'!A7) * (Main!C:C='Second'!E2) * (Main!G:G))}
I've interpreted the above as the first two sets of brackets being the range and condition to match and the last set being the range of values to return from. Is this a correct assumption and is this the correct use of that function?
Are there any other functions I could use?
Thank you, I have very little experience with Excel!
Have you taken a look at the magic INDEX combined with MATCH, and perhaps MATCH again?
INDEX returns the contents of a cell from a table provided a row and a column. Usage:
=INDEX([table to look in]; [COLUMN index]; [ROW index])
MATCH returns the indexes that match a criteria in the table. Usage:
=MATCH([Criteria];[table to look in])
And you can nest one inside the other the following way:
=INDEX([table to look for in];MATCH([Criteria];[Table to look for the particular Row]);[COLUMN, or a second MATCH to find the right column])
Or even combine a couple of MATCH as in
=INDEX([table to look for in];AND(MATCH(1);MATCH(2)); [Column to look for, or MATCH to look for in column])
Which I think is what you want.
If you need a SUM of something (as you used a SUM function before), just nest it inside the proper SUM function

Excel Formula Vlookup the value by referring Row and Column

In the sheet1 i have a table called working days of the countries as shown in the below image.
In the Sheet2 i have 10 columns in that based on the country and month by referring the this table i am trying to populate the values, When i tried doing by Vlookup the first row alone getting populated, but in the second row the header from F1:T1 is getting changed to F2:T2 so rest of the cells showing as #NA.
Anyone can you please give a solution for my issue. Here is the formula i have used.
=VLOOKUP(I1,Sheet1!F2:T7,MATCH(Sheet2!M1,Sheet1!F1:T1,0))
Thanks in Advance.
You are missing the symbol $ to lock the ranges, and the false condition to match exact values in the VLOOKUP.
It should be like:
=VLOOKUP(I1,Sheet1!$F$2:$T$7,MATCH(M1,Sheet1!$F$1:$T$1,0),0)
Or instead of VLOOKUP use HLOOKUP like:
=HLOOKUP(M1,Sheet1!$F$1:$T$7,MATCH(I1,Sheet1!$F$2:$F$7,0),0)
In general, combining the INDEX and MATCH functions is a superior option to VLOOKUP. For example, =INDEX(Sheet1!F:F,MATCH(Sheet2!M1,Sheet1!F1:T1,0)). This allows you to go left-to-right or right-to-left as well.
Snip for Index Match functions Using Vlookup won't work here because in the 2nd table you are repeating the country, unlike the first table. Use a combination of index match function, this is little trickier than the vlookup but it will fulfill your requirements.
Since I don't have the exact table you shared so I created a table on my end and sharing the snip here.

Two Column Lookup

I have a data set that I want to return an indexed column using two values: a year and a name. Both these values are formatted to general (I also tried text) in my spreadsheet.
In one work sheet I have a like of people:
On the other, I have a table of Years, Names, and a number
I am trying to do a lookup on the joined year and name and return the given number in the second table. For instance 2013Andrew McCutchen would return 8.2, and 2014Andrew McCutchen would return 6.8.
Currently, I only get the #N/a value with the following"
=INDEX('2006 Results'!C2:C556,MATCH($J$1&C3,'2006 Results'!$A$2&$B$556,0))
But, I know a certain value is in the table though because I have tested with an if statement to make sure my spelling is correct. Any guidance would be much appreciated.
I would add a column to the left of the year column as column A to contain the following formula in cell A2 which refers to the year and name column:
=$B2&$C2
You can then use this column in a VLOOKUP formula on the people sheet. Cell J3 would read as follows. Copy this to all cells in the table body.
=VLOOKUP(J$1&$C3,'TheYearSheet'!$A$1:$D$556,4,false)
Job done.
In your match expression, you are comparing one concatenated value $J$1&C3 to another single concatenated value '2006 Results'!$A$2&$B$556. Match expects that second parameter to be a range rather than a single value.
In cases like this, where multiple criteria are required, I prefer to use sumifs rather than index-match, even though the intention is to return a single value. I think =SUMIFS('2006 Results'!$C:$C,'2006 Results'!$A:$A,j$1,'2006 Results'!$B:$B,$c3) will give what you need and should correctly copy to the other cells in that table.

Resources