Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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...
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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Call macro stored in Excel workbook from Outlook's macro Gvaram Excel Programming 0 October 4th 06 05:47 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
translate lotus 1-2-3 macro into excel macro using excel 2000 krutledge0209 Excel Programming 1 November 2nd 04 05:50 PM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Excel Programming 2 May 25th 04 06:59 PM


All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"