Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about Excel Macro 1

Status
Not open for further replies.

Nullsweat

Technical User
Mar 13, 2003
16
US
Hola :)

My macro takes does a webquery for the data, then takes a changing list of names-sorts them and then does a vlookup on the data to get Productivity #s. The problem is that the names in the list are not always represented in the data. Therefor, I have added a ISERROR to get rid of the N/A's. I also had to use an IF statement to return a 0 for the ones that were TRUE.
The problem is that it does not just return specific data. After the first couple, it will repeat a found name's data for ANY name that does not have data, until it finds another name with data. Then it starts over and repeats that value. I have tried many combonations of the IF/ISERROR Formula. Here are some possible ones I have used.
=IF(ISERROR(VLOOKUP(I2,$C$2:$E$100,3,$E$2:$E$100))=TRUE,0,VLOOKUP(I2,$C$2:$E$100,3,$E$2:$E$100))

also tried
=ISERROR(VLOOKUP(I8,$C$2:$E$100,3,$E$2:$E$100))

Am I just not seeing it? Is there a missing Comma? I am pulling my Virtual Hair out....:)
Thanks In Advance :)
Sean

 
Hi,

the form of VLOOKUP in your case is...
Code:
VLOOKUP(I8,$C$2:$E$100,3,FALSE))
Code:
Syntax

VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)
where Range_lookup is a logical value that specifies whether you want VLOOKUP to find an exact match or an approximate match. If TRUE or omitted, an approximate match is returned. In other words, if an exact match is not found, the next largest value that is less than lookup_value is returned. If FALSE, VLOOKUP will find an exact match. If one is not found, the error value #N/A is returned.



Skip,
Skip@TheOfficeExperts.com
 
THANK YOU .....see I noticed that "named range" and my friend said that you can name a range instead of using Columns/Rows. I have read quite a few books and NEVER heard that mentioned. Thanks :)
Sean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top