Rowland Hamilton
Active Member
- Joined
- Nov 13, 2009
- Messages
- 250
Folks:
Column K contains my lookup values. Sometimes its just the cost center (CC), sometimes the cost center is to the middle, right or left of different words, hyphens, "/", etc. Many variations. Even the Cost Center numbers are not uniform.
But my table array has only 17 different cost centers.
Okay, how do I vba this the easiest way.
I think I can have about 19 if statements and do this but it seems less rational than doing some kind of array, looping combo.
I started to try and figure all the text variations, which CCs appear to the right or left of a hyphen but then decided to just search for the lookup values.
My formula that works but would be crazy:
I could keep nesting this formula into the middle where that 0 is, like this:
Do this for all 17 lookup values. At the end, I'd replace the zero(0) with $K3.
All this just seems crazy. I like bulding solutions that might work in Excel 2003, so don't want to rely on the beefed up if statement count of Excel 2010.
However, I will be nesting it until I find an easier solution.
Note: With VBA, I'd double quote and add filepath info to the lookup table.
Thank you, Rowland
Column K contains my lookup values. Sometimes its just the cost center (CC), sometimes the cost center is to the middle, right or left of different words, hyphens, "/", etc. Many variations. Even the Cost Center numbers are not uniform.
But my table array has only 17 different cost centers.
Okay, how do I vba this the easiest way.
I think I can have about 19 if statements and do this but it seems less rational than doing some kind of array, looping combo.
I started to try and figure all the text variations, which CCs appear to the right or left of a hyphen but then decided to just search for the lookup values.
My formula that works but would be crazy:
Code:
=IF(ISERROR(SEARCH('LookupTable!$G$2,Invoices!$K3)),0,'Lookup table'!$G$2)
Code:
=IF(ISERROR(SEARCH('LookupTable!$G$2,Invoices!$K3)),IF(ISERROR(SEARCH('LookupTable!$G$3,Invoices!$K3)),0,'Lookup table'!$G$3),'Lookup table'!$G$2)
All this just seems crazy. I like bulding solutions that might work in Excel 2003, so don't want to rely on the beefed up if statement count of Excel 2010.
However, I will be nesting it until I find an easier solution.
Note: With VBA, I'd double quote and add filepath info to the lookup table.
Thank you, Rowland
Last edited: