#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default VLOOUP

When I try to run this macro I pop box says, "Excel cannot complete
this task with available resources. Choose less data". What am I doing
wrong?


ActiveCell.FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC[-5],'Fall 2006 Cohort'!
R2C1:R65536C28,13,FALSE)=TRUE),"""", VLOOKUP(RC[-5],'Fall 2006 Cohort'!
R2C1:R65536C28,13,FALSE))"
ActiveCell.Offset(0, 1).Select

Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default VLOOUP

The part of the VLOOKUP function that refers to the lookup table refers
to R2C1:R65536C28. This is 1.8 million + cells of data. Do you really
have a lookup table that is that large???

You probably should find a way to set a range variable to just the
actual data area. Assuming that the data is in a list, where row 1 is
the column labels, then the following technique would locate the data
area first, then build the VLOOKUP formula, and finally build the entire
formula:

Also, I don't think you need the "=TRUE" part in your formula where you
are checking to see if the result of the VLOOKUP function ISNA.
You had something of the form:
"=IF(ISNA(VLOOKUP(...)=TRUE,"""",VLOOKUP(...)) "
It should be:
"=IF(ISNA(VLOOKUP(...),"""",VLOOKUP(...))"


Dim wsData As Worksheet
Dim rngDataArea As Range
Dim strVLookupFormula As String
Dim strFormula As String

Set wsData = Worksheets("Fall 2006 Cohort")
With wsData.UsedRange
'Actual data area is the used range less the column labels.
Set rngDataArea = .Offset(1).Resize(.Rows.Count - 1)
End With

strVLookupFormula = "VLOOKUP(RC[-5]," _
& rngDataArea.Address(ReferenceStyle:=xlR1C1, _
External:=True) & ",13,FALSE)"
strFormula = "=IF(ISNA(" & strVLookupFormula _
& "),""""," & strVLookupFormula & ")"

ActiveCell.FormulaR1C1 = strFormula
ActiveCell.Offset(0, 1).Select

Also, you should probably check what column the ActiveCell is in before
running this macro, as an error will result if it is less than 5 columns
from the left side of the worksheet (the "RC[-5]" part of the VLOOKUP
formula).
--
Regards,
Bill Renaud



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
VLOOUP Matt Excel Discussion (Misc queries) 2 January 24th 08 04:41 PM
vlooup with an if statement????? samiauthor Excel Worksheet Functions 2 August 14th 07 03:43 PM
vlooup formula and if(),isna etc Claudia Excel Worksheet Functions 3 May 29th 07 01:17 PM
Linking cells (VLOOUP/IF function maybe?) GregA Setting up and Configuration of Excel 2 August 20th 06 01:15 AM


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