View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RemyMaza RemyMaza is offline
external usenet poster
 
Posts: 15
Default Excel Macro Help

On Apr 3, 8:09*pm, RemyMaza wrote:
On Apr 3, 6:45*pm, JLGWhiz wrote:

For B1 do you have 42 variables or a variable with 42 possible values? *Makes
a big difference.


Here's the breakdown:
C2 - 3 variables
D2 - 42 variables

So it looks like 3*42... *Each variable in C2 has 42 variables.

I need to input C2 and D2 and come up with a value in another cell
based on those variables... *Here's what I have so far, but I can't
get past the first variable in A1... I mean if I put a 1 in A1, it
works fine, but I need the formula to continue if A1 equal 2 or 3...
The working code I have so far is:

=IF(C2=$K$1,VLOOKUP(D2,J2:K43,2,FALSE))

To make is simple K1 on this formula is only a number above my array.
This way I know which array I'm dealing with. *If there is a more
efficient way, I'm not binded to this formula. *I have 3 total arrays
that I need to lookup based on the first input i.e. =IF(C2= *So if C2
equals something other than 1 it will lookup in a different array.
The formula above works great but when I try to expand it to the three
arrays, I end up with a formula that looks like:

=IF(C2=$K
$1,VLOOKUP(D2,J2:K43,2,FALSE)*IF(C2=O1,VLOOKUP(D2, N2:O43,2,FALSE)*IF(C2=S1,*VLOOKUP(R2:S43,2,FALSE)) ))

This sadly doesn't work in excel and I'm not sure how to fix the
formula to look past the first variable if it changes.
Thanks for any help...

Matt


I just scrapped the 3 array approach. I took C2 input and added a
number to it that would offset it farther down the array. I combined
all three arrays into one, so with this new input it would look
throughout 1 array but farther down if C2 = 2 or if C2 = 3.... Worked
like a charm...