ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Modify Macro To LookUp 2 Tables (https://www.excelbanter.com/excel-programming/350663-modify-macro-lookup-2-tables.html)

Carl

Modify Macro To LookUp 2 Tables
 
I am using this code:

ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[9],refman,2,FALSE)"
Selection.Copy

I need to break up the table "refman" into 2 tables. Is it possible to have
the vlookup check both tables ( say refman1 and refman2) ?

Thank you in advance.

Jim Thomlinson[_5_]

Modify Macro To LookUp 2 Tables
 
The formula gets a bit ugly.

=if(countif(refman1, RC[9])0,
vlookup(RC[9],refman1,2,false),if(countif(refman2, RC[9])0,
vlookup(RC[9],refman2,2,false),"Not Found"))

Or something close to that...
--
HTH...

Jim Thomlinson


"carl" wrote:

I am using this code:

ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[9],refman,2,FALSE)"
Selection.Copy

I need to break up the table "refman" into 2 tables. Is it possible to have
the vlookup check both tables ( say refman1 and refman2) ?

Thank you in advance.


Carl

Modify Macro To LookUp 2 Tables
 
Thank you Jim. I tried placing this code and received a Compiler Error /
Syntax.

Here's the code I used:

ActiveCell.FormulaR1C1 = "=if(countif(refman1; RC[9])0; "
vlookup(RC[9];refman1;2;false);if(countif(refman2; RC[9])0;
vlookup(RC[9];refman2;2;false);"Not Found"))
"

"Jim Thomlinson" wrote:

The formula gets a bit ugly.

=if(countif(refman1, RC[9])0,
vlookup(RC[9],refman1,2,false),if(countif(refman2, RC[9])0,
vlookup(RC[9],refman2,2,false),"Not Found"))

Or something close to that...
--
HTH...

Jim Thomlinson


"carl" wrote:

I am using this code:

ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[9],refman,2,FALSE)"
Selection.Copy

I need to break up the table "refman" into 2 tables. Is it possible to have
the vlookup check both tables ( say refman1 and refman2) ?

Thank you in advance.



All times are GMT +1. The time now is 10:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com