Possible Look Up and Match With Condition

Celticshadow

Active Member
Joined
Aug 16, 2010
Messages
419
Office Version
  1. 365
Platform
  1. Windows
Hi Forum

I have two sheets one named Dist and the other Dist Res. What I would like help with is having a formula that will extract the date from col A in the Dist sheet which has a number equal to or lower than 2 (in col F) and is the latest occurrence and matches the horse in Dist Res sheet and places the date in B2 (If a horse does not have a number lower than 2 then return 0). I have attached an example below in the hope that it will make my query a little clearer.

So the Horse A Boy Named Ivy most recently ran a race with a dist btn less than or equal to 2 on the 15 September 2022 thus that date then needs copied and put into the Dist Res sheet next to said horse name in cell B2.

So the Horse A Case of You most recently ran a race with a dist btn less than or equal to 2 on the 11 February 2022 thus that date then needs copied and put into the Dist Res sheet next to said horse name in cell B2.

So the Horse A Distant Place has not most recently ran a race with a dist btn less than or equal to 2 thus that date does not exist thus a number zero nedds to be entered into the Dist Res sheet next to said horse name in cell B2.


Many thanks in advance.

Regards
 

Attachments

  • Extract Date 1 Query.png
    Extract Date 1 Query.png
    129.6 KB · Views: 20
  • Extract Date 2 Query.png
    Extract Date 2 Query.png
    94.9 KB · Views: 15

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi Forum

I have attached a google docs link with an explanation in the Dist Res sheet for reference which may help clarify my query a little better I hope. I look forward to hearing from you. Many thanks.

Regards




 
Upvote 0
it maybe my settings, but all i can see is an image - usually i get a different view and can download to excel
 
Upvote 0
it maybe my settings, but all i can see is an image - usually i get a different view and can download to excel
Hi etaf

Many thanks for replying it is much appreciated as I am completely stuck with this problem and would dearly wish it to be solved. I am unsure as to why the file can not be seen in google docs however I have loaded up a copy to dropbox and have attached a link below in the hope that this link will be more user friendly. Many thanks in advance.

Regards



PS Sincere apologies my fault entirely it was settings and here is the google docs link I hope.

 
Last edited:
Upvote 0
yes, that worked
as you have 365 version of excel
I think this will work
=MAX(FILTER(Dist!$A$2:$A$21,(Dist!$D$2:$D$21=A2)*(Dist!$F$2:$F$21<=2),0))

BUT because the cell will be formatted as date - then zero will display as a date 0/1/1900
working on that - to change the format - and format() did not work.....

Mr Excel Possible Look up.xlsm
ABC
1horse_nameDSDR
2A Boy Named IvyThursday, 15 September 2022Thursday, 15 September 2022
3A Case Of YouFriday, 11 February 2022Friday, 11 February 2022
4A Cheap ThrillFriday, 31 March 2023Friday, 31 March 2023
5A Distant Place0Saturday, 0 January 1900
Dist Res
Cell Formulas
RangeFormula
C2:C5C2=MAX(FILTER(Dist!$A$2:$A$21,(Dist!$D$2:$D$21=A2)*(Dist!$F$2:$F$21<=2),0))


Mr Excel Possible Look up.xlsm
ABCDEFG
1racedateracetimetrackhorse_namecomptime_numericTotalDstBtMedianOR
2Saturday, 26 March 202214:25DoncasterA Boy Named Ivy98.41.7583
3Saturday, 23 April 202214:20RiponA Boy Named Ivy100.521.2585.5
4Sunday, 8 May 202216:48HamiltonA Boy Named Ivy105.044.4080
5Sunday, 22 May 202217:05YorkA Boy Named Ivy96.456.0383.5
6Wednesday, 22 June 202214:55CarlisleA Boy Named Ivy98.048.4579
7Saturday, 6 August 202214:52RedcarA Boy Named Ivy94.365.0073.5
8Thursday, 15 September 202216:45AyrA Boy Named Ivy101.580.0070.5
9Saturday, 1 October 202215:57RedcarA Boy Named Ivy97.383.7577.5
10Friday, 11 February 202219:30DundalkA Case Of You72.461.25101
11Saturday, 21 May 202214:45CurraghA Case Of You72.124.25109
12Saturday, 18 June 202216:20AscotA Case Of You72.176.36112
13Sunday, 11 September 202214:25CurraghA Case Of You62.517.55107
14Saturday, 15 January 202211:45FairyhouseA Cheap Thrill25733.000
15Thursday, 10 February 202214:20ThurlesA Cheap Thrill256.0119.5092
16Friday, 30 September 202217:02Gowran ParkA Cheap Thrill314.30.00102
17Sunday, 11 December 202215:20CorkA Cheap Thrill302.739.6589.5
18Wednesday, 28 December 202212:35LeopardstownA Cheap Thrill320.930.75109
19Friday, 31 March 202318:40WexfordA Cheap Thrill453.91.8086
20Wednesday, 23 February 202215:00LudlowA Distant Place232.55.00118
21Wednesday, 30 March 202215:30Market RasenA Distant Place308.8768.25125
Dist


added to dropbox, will only be available for a few days



meanwhile i'll see how to get a date formatted cell to display a zero
 
Upvote 0
Solution
ok, that was interesting -
found in the forum here

change the format of the cells to
custom
[>0]dddd, dd mmmm yyyy;General

Mr Excel Possible Look up -ETAF.xlsm
ABCD
1horse_nameDSDR
2A Boy Named IvyThursday, 15 September 2022Thursday, 15 September 2022
3A Case Of YouFriday, 11 February 2022Friday, 11 February 2022
4A Cheap ThrillFriday, 31 March 2023Friday, 31 March 2023
5A Distant Place00
Dist Res
Cell Formulas
RangeFormula
C2:C5C2=MAX(FILTER(Dist!$A$2:$A$21,(Dist!$D$2:$D$21=A2)*(Dist!$F$2:$F$21<=2),TEXT(0,"0")))
 
Upvote 0
Dear etaf

I am ever so grateful that you have been kind enough to take time out of your day to pass on your knowledge and skillset to provide an answer to my query and queries of others. This forum and its members such as yourself never cease to amaze me, as you also have to try and decipher what luddites such as I are trying to convey before attempting to provide an answer. As per all my requests your solution works an absolute treat and I am truly thankful for your much needed help. Thank you ever so much.

Kindest Regards
 
Upvote 0
thanks for those kind remarks
you are very welcome
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top