Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Macro Help
I'm trying to make sure I'm headed down the right path before I spend
a ton of time for nothing, so any feedback is very much appreciated. Here's what I would like to happen within my excel worksheet. I will have two manual inputs that will relate to an end result in another cell. For instance, if I put a 1 in A1 and put a 22 in B1, I would need C1 to display a result based on a cell block's input. So A1+B1 = E1 but displayed in C1. I'm not sure if I should use a formula to derive my result or write a macro because my variables seem to be of a large number. For A1 I would have 3 variables and for B1 I would have 42 variables. What would be the best way to accomplish this task? If then statements or something else? I'm open to any ideas. Thanks in advance, Matt |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Macro Help
For B1 do you have 42 variables or a variable with 42 possible values? Makes
a big difference. "RemyMaza" wrote: I'm trying to make sure I'm headed down the right path before I spend a ton of time for nothing, so any feedback is very much appreciated. Here's what I would like to happen within my excel worksheet. I will have two manual inputs that will relate to an end result in another cell. For instance, if I put a 1 in A1 and put a 22 in B1, I would need C1 to display a result based on a cell block's input. So A1+B1 = E1 but displayed in C1. I'm not sure if I should use a formula to derive my result or write a macro because my variables seem to be of a large number. For A1 I would have 3 variables and for B1 I would have 42 variables. What would be the best way to accomplish this task? If then statements or something else? I'm open to any ideas. Thanks in advance, Matt |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Macro Help
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Call macro stored in Excel workbook from Outlook's macro | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
translate lotus 1-2-3 macro into excel macro using excel 2000 | Excel Programming | |||
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet | Excel Programming |