Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
sgl sgl is offline
external usenet poster
 
Posts: 80
Default Lookup closest to

I have the following table

Name Date Amount
Anemi Test 31-Dec-11 500
Apnea 1 31-Dec-11 300
NB 1 Panamax 31-Dec-13 275
NB 2 Supramax 15-Nov-11 300
Anemi Test 19 Nov 11 123
Anemi Test 30-Nov-11 200
Anemi Test 31-Dec-11 75

I also have a Starting Date which say in this first instance is 1 Jan 12.
I want to find and SUM the value for each item nearest to the starting date.
In the above the result for Anemi Test would be 375, the SUM for NB 2
Supramax would be 300 and so on. If I were to make the starting date 1 Dec 11
then the result for Anemi Test would be 200 and for NB 2 Supramax would again
be 300.

Thanks in advance/sgl




  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 896
Default Lookup closest to

say yr data is in A1:C7
product (i.e. Anemi Test) being in E1
1 Dec 11 in F1

would this:

=SUM(IF(E1=$A$1:$A$7,IF(F1-$B$1:$B$7=MIN(IF(F1$B$1:$B$7,F1-$B$1:$B
$7,"")),$C$1:$C$7,),))

be helpful?
CTRL+SHIFT+ENTER this formula as this is an array-formula





On 16 Mar, 14:50, sgl wrote:
I have the following table

Name * * * * * * * * * * * * * * * * *Date * * * * * * * * * Amount
Anemi Test * * * * * * * * * * * * *31-Dec-11 * * * * * * *500
Apnea 1 * * * * * * * * * * * * * * * 31-Dec-11 * * * * * * 300
NB 1 Panamax * * * * * * * * * * *31-Dec-13 * * * * * * 275
NB 2 Supramax * * * * * * * * * * 15-Nov-11 * * * * * *300
Anemi Test * * * * * * * * * * * * * 19 Nov 11 * * * * * *123
Anemi Test * * * * * * * * * * * * * 30-Nov-11 * * * * * *200
Anemi Test * * * * * * * * * * * * * 31-Dec-11 * * * * * * *75

I also have a Starting Date which say in this first instance is 1 Jan 12.
I want to find and SUM the value for each item nearest to the starting date.
In the above the result for Anemi Test would be 375, the SUM for NB 2
Supramax would be 300 and so on. If I were to make the starting date 1 Dec 11
then the result for Anemi Test would be 200 and for NB 2 Supramax would again
be 300.

Thanks in advance/sgl


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 896
Default Lookup closest to

or simpler:

=SUM(IF((E1=$A$1:$A$7)*(F1-$B$1:$B$7=MIN(IF(F1$B$1:$B$7,F1-$B$1:$B
$7,""))),$C$1:$C$7,),)

also CTRL+SHIFT+ENTER this

On 16 Mar, 15:30, Jarek Kujawa wrote:
say yr data is in A1:C7
product (i.e. Anemi Test) being in E1
1 Dec 11 in F1

would this:

=SUM(IF(E1=$A$1:$A$7,IF(F1-$B$1:$B$7=MIN(IF(F1$B$1:$B$7,F1-$B$1:$B
$7,"")),$C$1:$C$7,),))

be helpful?
CTRL+SHIFT+ENTER this formula as this is an array-formula

On 16 Mar, 14:50, sgl wrote:



I have the following table


Name * * * * * * * * * * * * * * * * *Date * * * * * * * * * Amount
Anemi Test * * * * * * * * * * * * *31-Dec-11 * * * * * * *500
Apnea 1 * * * * * * * * * * * * * * * 31-Dec-11 * * * * * * 300
NB 1 Panamax * * * * * * * * * * *31-Dec-13 * * * * * * 275
NB 2 Supramax * * * * * * * * * * 15-Nov-11 * * * * * *300
Anemi Test * * * * * * * * * * * * * 19 Nov 11 * * * * * *123
Anemi Test * * * * * * * * * * * * * 30-Nov-11 * * * * * *200
Anemi Test * * * * * * * * * * * * * 31-Dec-11 * * * * * * *75


I also have a Starting Date which say in this first instance is 1 Jan 12.
I want to find and SUM the value for each item nearest to the starting date.
In the above the result for Anemi Test would be 375, the SUM for NB 2
Supramax would be 300 and so on. If I were to make the starting date 1 Dec 11
then the result for Anemi Test would be 200 and for NB 2 Supramax would again
be 300.


Thanks in advance/sgl- Ukryj cytowany tekst -


- Pokaż cytowany tekst -


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default Lookup closest to

Hi,

You may use this array formula (Ctrl+Shift+Enter). D26 will hold Anemi Test
and E26 will hold 1 Jan 12

=SUMPRODUCT(--(E18:E24=MAX(IF(($D$18:$D$24=D26)*($E$18:$E$24<=E2 6),E18:E24))*(D18:D24=D26)),F18:F24)

I have feeling that I have complicated the solution. I am sure there is an
easier non-array formula solution available as well. Nevertheless this
solution will work for you.

By the way the first answer should be 575 and not 375.

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"sgl" wrote in message
...
I have the following table

Name Date Amount
Anemi Test 31-Dec-11 500
Apnea 1 31-Dec-11 300
NB 1 Panamax 31-Dec-13 275
NB 2 Supramax 15-Nov-11 300
Anemi Test 19 Nov 11 123
Anemi Test 30-Nov-11 200
Anemi Test 31-Dec-11 75

I also have a Starting Date which say in this first instance is 1 Jan 12.
I want to find and SUM the value for each item nearest to the starting
date.
In the above the result for Anemi Test would be 375, the SUM for NB 2
Supramax would be 300 and so on. If I were to make the starting date 1 Dec
11
then the result for Anemi Test would be 200 and for NB 2 Supramax would
again
be 300.

Thanks in advance/sgl




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
sgl sgl is offline
external usenet poster
 
Posts: 80
Default Lookup closest to

Ashish thank you very much that worked very well
sgl

"Ashish Mathur" wrote:

Hi,

You may use this array formula (Ctrl+Shift+Enter). D26 will hold Anemi Test
and E26 will hold 1 Jan 12

=SUMPRODUCT(--(E18:E24=MAX(IF(($D$18:$D$24=D26)*($E$18:$E$24<=E2 6),E18:E24))*(D18:D24=D26)),F18:F24)

I have feeling that I have complicated the solution. I am sure there is an
easier non-array formula solution available as well. Nevertheless this
solution will work for you.

By the way the first answer should be 575 and not 375.

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"sgl" wrote in message
...
I have the following table

Name Date Amount
Anemi Test 31-Dec-11 500
Apnea 1 31-Dec-11 300
NB 1 Panamax 31-Dec-13 275
NB 2 Supramax 15-Nov-11 300
Anemi Test 19 Nov 11 123
Anemi Test 30-Nov-11 200
Anemi Test 31-Dec-11 75

I also have a Starting Date which say in this first instance is 1 Jan 12.
I want to find and SUM the value for each item nearest to the starting
date.
In the above the result for Anemi Test would be 375, the SUM for NB 2
Supramax would be 300 and so on. If I were to make the starting date 1 Dec
11
then the result for Anemi Test would be 200 and for NB 2 Supramax would
again
be 300.

Thanks in advance/sgl







  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default Lookup closest to

You are welcome. Thank you for the feedback

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"sgl" wrote in message
...
Ashish thank you very much that worked very well
sgl

"Ashish Mathur" wrote:

Hi,

You may use this array formula (Ctrl+Shift+Enter). D26 will hold Anemi
Test
and E26 will hold 1 Jan 12

=SUMPRODUCT(--(E18:E24=MAX(IF(($D$18:$D$24=D26)*($E$18:$E$24<=E2 6),E18:E24))*(D18:D24=D26)),F18:F24)

I have feeling that I have complicated the solution. I am sure there is
an
easier non-array formula solution available as well. Nevertheless this
solution will work for you.

By the way the first answer should be 575 and not 375.

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"sgl" wrote in message
...
I have the following table

Name Date Amount
Anemi Test 31-Dec-11 500
Apnea 1 31-Dec-11 300
NB 1 Panamax 31-Dec-13 275
NB 2 Supramax 15-Nov-11 300
Anemi Test 19 Nov 11 123
Anemi Test 30-Nov-11 200
Anemi Test 31-Dec-11 75

I also have a Starting Date which say in this first instance is 1 Jan
12.
I want to find and SUM the value for each item nearest to the starting
date.
In the above the result for Anemi Test would be 375, the SUM for NB 2
Supramax would be 300 and so on. If I were to make the starting date 1
Dec
11
then the result for Anemi Test would be 200 and for NB 2 Supramax would
again
be 300.

Thanks in advance/sgl





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
Array Lookup to Find Closest Date and Next Closest Date [email protected] Excel Worksheet Functions 7 November 7th 07 03:04 AM
Closest value lookup? ADK Excel Worksheet Functions 12 June 21st 07 09:13 PM
how do i look up the closest number valuein a lookup? lepche Excel Discussion (Misc queries) 3 May 14th 07 04:19 PM
Lookup Closest Value chad Excel Worksheet Functions 3 September 29th 06 07:58 PM
Lookup closest number in list Jeff Excel Discussion (Misc queries) 6 November 26th 04 07:27 PM


All times are GMT +1. The time now is 03:16 AM.

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

About Us

"It's about Microsoft Excel"