Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 202
Default Function to Return a Date Value Q

I looking for a function that will return the value that is in one of
5 cells that is matches the closest to Todays date. Thus -

I have 5 date values in cells A5 to E5
Todays date is in A1
In A10 I want to return the value of one of A5-E5 that is closest to
todays date that is in A1
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 829
Default Function to Return a Date Value Q

"Seanie" wrote:
I looking for a function that will return the value
that is in one of 5 cells that is matches the closest
to Todays date. Thus -
I have 5 date values in cells A5 to E5
Todays date is in A1
In A10 I want to return the value of one of A5-E5 that
is closest to todays date that is in A1


Depends on what you mean by "closest". Perhaps:

=LOOKUP(A1,A5:E5)

formatted as Date. But that returns the closest date that is the same or
earlier. So if B5 contains 3/1/2012 (March 1), C5 contains 4/1/2012 and A1
contains 3/31/2012, LOOKUP will return 3/1/2012, not 4/1/2012. Okay?

Note: LOOKUP requires that A5:E5 be in ascending order. Okay?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 73
Default Function to Return a Date Value Q

On Monday, June 25, 2012 4:14:27 PM UTC+1, joeu2004 wrote:
"Seanie" wrote:
I looking for a function that will return the value
that is in one of 5 cells that is matches the closest
to Todays date. Thus -
I have 5 date values in cells A5 to E5
Todays date is in A1
In A10 I want to return the value of one of A5-E5 that
is closest to todays date that is in A1


Depends on what you mean by "closest". Perhaps:

=LOOKUP(A1,A5:E5)

formatted as Date. But that returns the closest date that is the same or
earlier. So if B5 contains 3/1/2012 (March 1), C5 contains 4/1/2012 and A1
contains 3/31/2012, LOOKUP will return 3/1/2012, not 4/1/2012. Okay?

Note: LOOKUP requires that A5:E5 be in ascending order. Okay?


Thanks the 'same or earlier' doesn't really work for me, as the closest might be greater than todays date
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 73
Default Function to Return a Date Value Q

On Monday, June 25, 2012 7:14:39 PM UTC+1, Claus Busch wrote:
Hi Sean,

Am Mon, 25 Jun 2012 10:55:06 -0700 (PDT) schrieb :

Thanks the 'same or earlier' doesn't really work for me, as the closest might be greater than todays date


try:
=MIN(IF(ABS(A5:E5-$A$1)=MIN(ABS(A5:E5-$A$1)),A5:E5))
and enter the formula with CTRL+Shift+Enter


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2


Bingo! that seems to have worked great, Thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Howw can I make a function return a date in date format Jan Kronsell Excel Programming 12 January 21st 10 04:24 PM
Function to return column where a date is entered Barb Reinhardt[_3_] Excel Programming 1 August 11th 07 02:06 AM
Using TODAY function to return a date as text GH Excel Discussion (Misc queries) 1 December 19th 06 06:17 PM
Need a function or formulae that will return the current date + 1 scott56hannah Excel Worksheet Functions 3 July 28th 06 12:05 AM
Date Function formula that will return the date of a specific week Greg Excel Worksheet Functions 4 June 12th 06 05:07 PM


All times are GMT +1. The time now is 02:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"