Excel formula or vlookup to pick latest date? - excel

i am using vlookup and want to have the latest date to be picked from multiple entries as listed below, please advise if any one can help in this regard.
Now i want to pick latest date for ALi, Mubeen and Nadeem from the corresponding column of date. e.g i can pick Ali and latest date for this one is 5-Dec-20.
Please advise.

i think if your concern is only for Min value, then best method will be to do it by pivot tables.
Drag name to columns and date to values in pivot tables. Now convert the date value to Minimum. This will get the things done.
Hope the query is clear.

You can use following array formula:
=MAX(IF($A$2:$A$10=D2,$B$2:$B$10))
Array formula after editing is confirmed by pressing ctrl + shift + enter

You can put all the dates in a hidden column and get the min value like this:
The red cells formula: =IFERROR(INDEX($B$3:$B$13, SMALL(IF(D$2=$A$3:$A$13, ROW($B$3:$B$13)-2,""), ROW()-2)),"")
The blue cell formula: =MIN(D3:D6)

You can use the MAXIFS function,
=MAXIFS(B3:B6,A3:A6,C2)

Related

Search data between dates and name in Excel

I have a problem where i need to get the last section through between dates and Name
i try this formula but it only search for exact date
=LOOKUP(G2,A1:A5,C1:C5)
it gives me a answer of #N/A
and also i dont know how to search it by name
As you are using Excel-2010 then try below array formula.
=INDEX(C1:C5,LARGE(IF((A1:A5>=G2)*(A1:A5<=G3)*(B1:B5=G4),ROW(C1:C5),""),1))
Array formula need to put with CTRL+SHIFT+ENTER.
If you have Excel365 then can try XLOOKUP()
=XLOOKUP(1,(A1:A5>=G2)*(A1:A5<=G3)*(B1:B5=G4),C1:C5,,0,-1)

Using an Excel formula to read a date corresponding to a cell

Please see the screenshot of my schedule below.
I need a formula that will populate the END_DATE column with the date corresponding to the very last (rightmost) 'x' for each row..
Is there a way to read the rightmost 'x' in a row, and populate a cell with the date above that 'x'?
Any help is much appreciated.
Thanks,
PJ
Updated based on #Dan's very correct feedback
You can use Array/CSE formula:
=INDEX($E$4:$K$4, 1, MAX(IF(E5:K5="X",COLUMN(E5:K5)-(COLUMN(E5)-1))))
Using Ctrl+Shift+Enter to enter that in. This will find the max column number that contains an X and subtract 3 from it (assuming the range we are searching is D2:J2, otherwise the -3 will have to be adjusted to compensate. Then using Index() to find the corresponding value for that column.
as an alternative to an array or CSE formula you can use aggregate which performs array like operations within the aggregate function. Adjust the references to suit your needs, but avoid using full row/column references within aggregate due to the array like calculations it performs.
This solution uses a combination of INDEX and AGGREGATE
=INDEX($4:$4,AGGREGATE(14,6,COLUMN($E5:$K5)/($E5:$K5="x"),1))
I used the above formula in the yellow cells shown in the example below.

Find exact date or nearest date in a range of dates using excel formula

I tried to find the Inv Cost. I used vlookup to used it.
Please refer below image for more details.
As you can see from the sheet1 I'm taking Actual finish date and product number to compare from sheet2 product number & cost date.
The excel formul find the exact date and number display on Inv Cost column. If can't find, Inv Cost should display the nearest date in the range of dates in excel sheet.
But my excel vlookup formul show N/A. my excel formula is below:
=VLOOKUP(B2&A2,Sheet2!C:D,2,FALSE)
Please advise on this.Thanks.
If you wanted to find the nearest date, you would need an array formula like this one
=INDEX(Sheet2!D$2:D$10,MATCH(TRUE,IF(B2=Sheet2!A$2:A$10,ABS(Sheet2!B$2:B$10-A2))=MIN(IF(B2=Sheet2!A$2:A$10,ABS(Sheet2!B$2:B$10-A2))),0))
Must be entered with CtrlShiftEnter
Try changing the last parameter of the VLOOKUP function to TRUE
=VLOOKUP(B2&A2, Sheet2!C:D, 2, TRUE)
Setting it to FALSE looks for an exact match.
However, it gives me a different result from what you're expecting.
For these cases where you have to find the next or previous closest result I preffer, and I think it's the most suitable, using INDEX/MATCH.
The formula would be like this.... try it...
=INDEX('Sheet2'!D2:D5;MATCH(CONCATENATE(B2;A2);'Sheet2'!C2:C5;-1))
Write this formula on sheet1 and scroll down, let me know if it works or not :D

Show dates only after a specific date using calculated columns

I need to show dates only after 31/12/2012. The Date column used here is a calculated column. I used the formula =[Created]>12/31/2012. But I need help with the syntax.
Any help will be appreciated.
Thanks in advance.
If you need only "Yes/No" value to filter Created date then your formula is correct. You may have a problem if your regional settings are MM/DD/YYYY. In that case you should change the formula to [Created]>31/12/2012. Or the better way would be to change the condition to [Created]>=01/01/2013.
If you need the date, not "Yes/No" column, then this formula should work for you:
=IF([Created]>=1/1/2013,[Created],"TOO OLD")

Find MIN/MAX date in a range if it matches criteria of other columns

Column A is date
Column B is criteria
I want to find the MIN date for each criteria. I tried using Ctrl+Shift+Enter with
=MIN(MATCH(B2,B:B,0))
but thats not quite right because I need to refer to Column A somehow to get the date. I'm pretty confident this can be done with arrays, so any help would be great.
Try this (array formula):
=MIN(IF(B2=B:B,A:A))
An even more compact array formula is:
=MINIF(B2=B:B,A:A)
NOTE 1: Complete using Ctrl+Shift+Enter to enter the formula as an array formula.
NOTE 2: The two-formula method (i.e., using =MIN(IF(B2=B:B,A:A))) is more flexible and works in more cases than the single-formula method shown here but I've included it as an answer as a possible option.
=SMALL(INDEX(($F$2:$F$14=F3)*$D$2:$D$14,),SUM(COUNTA(F:F)-COUNTIF(F:F,F3)))
If your criteria is repeated and want to find the min date for that you can use this without shift+ctrl + enter function.
date is D column
criteria is F column

Resources