Index Match Closest Value without Going Over

Status
Not open for further replies.

seans81

New Member
Joined
May 14, 2020
Messages
17
Office Version
  1. 2010
Platform
  1. Windows
Hello,

I want to start by saying I am using ctr + shift + enter.

I have a workbook with 2 worksheets. The first worksheet (sheet1) has dates in column A, company name in column H

The second worksheet is called "Reference' and it has company name in column B, product in column C, and most recent order date in column G

I'm trying to match the date in sheet 1 to the closest date in sheet 2 for each company and return the product they ordered from column C. I wrote an index match function to try and accomplish this but I'm having an issue.

The formula works, but I need it to find the closest date value without going over the date in column A of Sheet1. Currently since its using abs function, it finds the closest value, even if its above the value.


=INDEX(Reference!$C$2:$C$70,MATCH(MIN(IF($H2=Reference!$B$2:$B$70,ABS($A2-Reference!$G$2:$G$70))),IF($H2=Reference!$B$2:$B$70,ABS($A2-Reference!$G$2:$G$70)),0))

Any help is appreciated!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Duplicate of
 
Upvote 0
Please do not post the same question multiple times. Questions of a duplicate nature will be locked or deleted, per #12 of the Forum Rules and points 6 & 7 of the Guidelines.

Any bumps, clarifications, or follow-ups should be posted to the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,584
Messages
6,120,387
Members
448,956
Latest member
JPav

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