Find the oldest date in one cell based on a search for a keyword in other column

criscocube

New Member
Joined
Jan 4, 2017
Messages
19
Hi all,

I have a spreadsheet with around 20,000 rows with two relevant columns, date, another cell with "ingredients", the ingredients column can have anywhere from 1 to like 10 items in it, the date cell is in a few formats (sometimes with month/day/year sometimes just year, and in one case a ton of extra serial number **** before the date, i can probably figure out how to remove that in any case).

I need to find the oldest instance of each ingredient (hundreds of unique), regardless of all the other ingredients.

So a sample of what this looks like:

[TABLE="width: 500"]
<tbody>[TR]
[TD]apples, cookies, flour, dead babies, grass[/TD]
[TD]2013-06-24[/TD]
[/TR]
[TR]
[TD]sand, rocks, ice, flour[/TD]
[TD]2000-03-01[/TD]
[/TR]
[TR]
[TD]wood, grass, oranges[/TD]
[TD]1973[/TD]
[/TR]
[TR]
[TD]water, air[/TD]
[TD]1923[/TD]
[/TR]
[TR]
[TD]cookies[/TD]
[TD]A94B324 2014[/TD]
[/TR]
</tbody>[/TABLE]


I feel like im overlooking some simple/obvious function in Excel to do this... or does it require a quick VBA macro?

Thanks!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi criscocube,

This is an array formula, add with ctrl+shift+enter (Excel with add { } around it if done right), 'ingreds' is your column with ingredient list, 'idates' is the column of dates. Formula assumes that you have already corrected the date format issue and they are valid dates. (if that's not the case it's of course a very different question....)

=MIN(IF(ISNUMBER(SEARCH(D1,ingreds)),idates))


*edit: forgot to mention, D1 is where you type what you want to search for
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
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