Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
carlosgdlf
 
Posts: n/a
Default vlookup inside an if statement?


Hi everybody!

I have to do a vertical lookup of an object that might or might not
exist, in case it doesnt exist normally it gives back Ref! but the
thing is that if this objet doesnt appear on the data base is because
is zero.

This Ref! is not allowing me to make a sum since this objet is part of
it.
Maybe with an example would be easier to explain.


i have to pull from a database the number of cars sold of three brands
A,B, C, In the database unless is one car of the type it will not
appear.
lets say we have 3 B cars, 5 C cars and no A cars

i will have as a result of three vlookups one in each celd ref!(since
there is not any A car), 3 and 5 the in other celd I have the the sum
of this three but since I have that ref! the result will be a ref! as
well!

I would like that when the vlookup doesnt find any match(like A cars
in the example) give back a zero as result instead of a Ref!

Thanks in advance
Carlos


--
carlosgdlf
------------------------------------------------------------------------
carlosgdlf's Profile: http://www.excelforum.com/member.php...o&userid=25821
View this thread: http://www.excelforum.com/showthread...hreadid=392717

  #2   Report Post  
CLR
 
Posts: n/a
Default

The normal error when VLOOKUP doesn't find a match is #N/A rather than Ref!
To return a result of 0 instead of the #N/A, use something like
this.........

=IF(ISNA(YourVlookupFormula),0,YourVlookupFormula)

Vaya con Dios,
Chuck, CABGx3


"carlosgdlf" wrote
in message ...

Hi everybody!

I have to do a vertical lookup of an object that might or might not
exist, in case it doesnt exist normally it gives back Ref! but the
thing is that if this objet doesnt appear on the data base is because
is zero.

This Ref! is not allowing me to make a sum since this objet is part of
it.
Maybe with an example would be easier to explain.


i have to pull from a database the number of cars sold of three brands
A,B, C, In the database unless is one car of the type it will not
appear.
lets say we have 3 B cars, 5 C cars and no A cars

i will have as a result of three vlookups one in each celd ref!(since
there is not any A car), 3 and 5 the in other celd I have the the sum
of this three but since I have that ref! the result will be a ref! as
well!

I would like that when the vlookup doesnt find any match(like A cars
in the example) give back a zero as result instead of a Ref!

Thanks in advance
Carlos


--
carlosgdlf
------------------------------------------------------------------------
carlosgdlf's Profile:

http://www.excelforum.com/member.php...o&userid=25821
View this thread: http://www.excelforum.com/showthread...hreadid=392717



  #3   Report Post  
Tim C
 
Posts: n/a
Default

Try:

=IF(ISERROR(YourFormula,0,YourFormula)

Tim C

"carlosgdlf"
wrote:

Hi everybody!

I have to do a vertical lookup of an object that might or might not
exist, in case it doesnt exist normally it gives back Ref! but the
thing is that if this objet doesnt appear on the data base is because
is zero.

This Ref! is not allowing me to make a sum since this objet is part of
it.
Maybe with an example would be easier to explain.


i have to pull from a database the number of cars sold of three brands
A,B, C, In the database unless is one car of the type it will not
appear.
lets say we have 3 B cars, 5 C cars and no A cars

i will have as a result of three vlookups one in each celd ref!(since
there is not any A car), 3 and 5 the in other celd I have the the sum
of this three but since I have that ref! the result will be a ref! as
well!

I would like that when the vlookup doesnt find any match(like A cars
in the example) give back a zero as result instead of a Ref!

Thanks in advance
Carlos



  #4   Report Post  
RWN
 
Posts: n/a
Default

I would like that when the vlookup doesn't find any match(like A cars
in the example) give back a zero as result instead of a Ref!


The way I do it;

IF(ISNA(vlookup(......)),0,vlookup(....))
Says "If the result of the lookup isn't found, put a zero in this cell, else return the
target of the lookup".

But;
Are you getting a "N/A" or, as you put it, a "Ref!" - They're different.
"N/A" means no value found (no "A" cars as per your question) whereas "REF!" means that
you've stipulated a return column that exceeds the range of the table.
Say your range is A1 to C3 (three columns) and your Vlookup says that on a match bring the
value located in col 4 then you'll get the REF! error.
Or you may be using a named range but have used another (non-existent) name in your
statement.
--
Regards;
Rob
------------------------------------------------------------------------
"carlosgdlf" wrote in message
...

Hi everybody!

I have to do a vertical lookup of an object that might or might not
exist, in case it doesnt exist normally it gives back Ref! but the
thing is that if this objet doesnt appear on the data base is because
is zero.

This Ref! is not allowing me to make a sum since this objet is part of
it.
Maybe with an example would be easier to explain.


i have to pull from a database the number of cars sold of three brands
A,B, C, In the database unless is one car of the type it will not
appear.
lets say we have 3 B cars, 5 C cars and no A cars

i will have as a result of three vlookups one in each celd ref!(since
there is not any A car), 3 and 5 the in other celd I have the the sum
of this three but since I have that ref! the result will be a ref! as
well!

I would like that when the vlookup doesnt find any match(like A cars
in the example) give back a zero as result instead of a Ref!

Thanks in advance
Carlos


--
carlosgdlf
------------------------------------------------------------------------
carlosgdlf's Profile: http://www.excelforum.com/member.php...o&userid=25821
View this thread: http://www.excelforum.com/showthread...hreadid=392717



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
vlookup inside an if statement? carlosgdlf Excel Discussion (Misc queries) 3 August 4th 05 02:36 AM
Using Concatenate inside a vlookup bmclean Excel Worksheet Functions 3 July 5th 05 09:29 PM
Date Format Inside of a SUMIF Statement Minitman Excel Worksheet Functions 9 June 13th 05 07:52 PM
Do I need a sumif or sum of a vlookup formula? PeterB Excel Worksheet Functions 0 June 1st 05 12:23 PM
Vlookup of an if statement return James Excel Worksheet Functions 2 April 6th 05 10:28 PM


All times are GMT +1. The time now is 06:36 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"