Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
simbob
 
Posts: n/a
Default need Lookup table to return null or zero

I need the lookup fucntion to return a null or a zero when it cannot
find the value required? Currently it is returning the next nearest
value!!

For example:
Col A Col B
07-Jul-05 1
08-Jul-05 4
11-Jul-05 3
12-Jul-05 3

If I lookup for 9-Jul-05 It will return "4" where I need a 0 or null!!

Must be an easy one but I have gone cross eyed!! Chairs

  #2   Report Post  
KL
 
Posts: n/a
Default

=IF(COUNTIF(A1:A4,--"9-Jul-05"),VLOOKUP(--"9-Jul-05",A1:B4,2,0),0)

=IF(ISNA(VLOOKUP(--"9-Jul-05",A1:B4,2,0)),0,VLOOKUP(--"9-Jul-05",A1:B4,2,0))

Regards,
KL

"simbob" wrote in message
ups.com...
I need the lookup fucntion to return a null or a zero when it cannot
find the value required? Currently it is returning the next nearest
value!!

For example:
Col A Col B
07-Jul-05 1
08-Jul-05 4
11-Jul-05 3
12-Jul-05 3

If I lookup for 9-Jul-05 It will return "4" where I need a 0 or null!!

Must be an easy one but I have gone cross eyed!! Chairs



  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default

=IF(ISNA(MATCH(D1,A:A,0)),0,INDEX(B:B,MATCH(D1,A:A ,0)))

assuming test date is in D1

--
HTH

Bob Phillips

"simbob" wrote in message
ups.com...
I need the lookup fucntion to return a null or a zero when it cannot
find the value required? Currently it is returning the next nearest
value!!

For example:
Col A Col B
07-Jul-05 1
08-Jul-05 4
11-Jul-05 3
12-Jul-05 3

If I lookup for 9-Jul-05 It will return "4" where I need a 0 or null!!

Must be an easy one but I have gone cross eyed!! Chairs



  #4   Report Post  
Ashish Mathur
 
Posts: n/a
Default

Dear Simbob,

Your Vlookup formula has to be as follows:

VLOOKUP(C10,C7:D8,2,TRUE)

The true in the formula gives an "exact match"

Since there is no exact match, the value will be an error value and not 4

C10 houses the date you are searching for
C7:D8 is the table range

As of now the result is after assuming that the last argument is "false"

"simbob" wrote:

I need the lookup fucntion to return a null or a zero when it cannot
find the value required? Currently it is returning the next nearest
value!!

For example:
Col A Col B
07-Jul-05 1
08-Jul-05 4
11-Jul-05 3
12-Jul-05 3

If I lookup for 9-Jul-05 It will return "4" where I need a 0 or null!!

Must be an easy one but I have gone cross eyed!! Chairs


  #5   Report Post  
KL
 
Posts: n/a
Default


The true in the formula gives an "exact match"


I thought it was exactly the opposite :-)

KL




  #6   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

Let A2:B5 house the sample table you provided. If this table is sorted
in ascending order and you want to effect an exact match and 0 upon failu

=IF(VLOOKUP(Date,$A$2:$A$5,1,1)=Date,VLOOKUP(Date, $A$2:$B$5,2,1),0)

If A2:B5 is unsorted...

=IF(ISNUMBER(MATCH(Date,$A$2:$A45,0)),VLOOKUP(Date ,$A$2:$B$5,2,0),0)

simbob wrote:
I need the lookup fucntion to return a null or a zero when it cannot
find the value required? Currently it is returning the next nearest
value!!

For example:
Col A Col B
07-Jul-05 1
08-Jul-05 4
11-Jul-05 3
12-Jul-05 3

If I lookup for 9-Jul-05 It will return "4" where I need a 0 or null!!

Must be an easy one but I have gone cross eyed!! Chairs

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
How to create a lookup table with an added varable? GIZZMO Excel Worksheet Functions 3 April 6th 09 10:32 PM
Return cell contents based on conditional lookup jarviscars Excel Worksheet Functions 15 August 5th 05 08:05 AM
Lookup with multiple value return Mike Quinn, SrA, USAF Excel Worksheet Functions 2 February 15th 05 05:15 PM
Return Multiple Results with Lookup Josh O. Excel Worksheet Functions 1 February 4th 05 08:07 PM
How do I lookup and return different values when the lookup value. kg Excel Discussion (Misc queries) 1 January 20th 05 12:53 AM


All times are GMT +1. The time now is 09:32 PM.

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"