Lookup a date and roundup to the next date from a specified list

eagow

New Member
Joined
Jul 16, 2011
Messages
2
Hi

I'm trying to create a payroll spreadsheet and I have the following in the rows:

1 Date (increasing by day) e.g. 16Jul, 17Jul, 18Jul, 19Jul, 20Jul etc.
2 Payroll Cutoff date

In the second row I would like a formula that looks up the cutoff date using the date above. I.e. it will need to find the date from a list which is the next cutoff date (greater than or equal date).

In a separate worksheet I then have the list of payrol cutoff dates in a named array called 'cutoff':

20Jul
10Aug
20Aug
etc.

I have tried using the MATCH and INDEX formulas, so in cell A2 I tried:
=INDEX(cutoff,MATCH(EK2,cutoff,-1))
but I just get a #N/A error.

Any ideas how to get around this?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hello eagow, welcome to MrExcel

You need MATCH with a "match type" of 1 if the cutoff dates are in ascending order. Try

=INDEX(cutoff,MATCH(EK2-1,cutoff,1)+1)

You might get #N/A error if EK2-1 is before the first date in cutoff list. You can work around that by adding an earlier date (or zero) to the start of cutoff.

Alternatively you can use an "array formula"

=MIN(IF(cutoff>=EK2,cutoff))

confirmed with CTRL+SHIFT+ENTER

Note: assumes your data consists of "real" dates (not text)
 
Upvote 0
Wow, wasn't expecting a reply so soon! Thanks Barry

That works great- I guess I had the dates sorting order mixed up in my head! I'll have a play with the array formula as well- just starting using them. It's opened up a whole new world of excel I never knew about!
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,794
Members
452,943
Latest member
Newbie4296

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