Help with getting variable outputs from a single input

Mikbob

New Member
Joined
Aug 11, 2017
Messages
2
Hello,

I like to think I'm fairly proficient at Excel, but this has really stumped me. I've tried searching, but I'm not really sure what I'm asking for.

Basically I have a sheet with a number of formulae spread across it, with numerous inputs and formulae leading on from each other. What I want to create is a list of outputs when I alter one of the input variables.

So, I thought I could create a list of the input variables on another sheet, then interrogate the output cell so that I get an answer if the input cell equals the cell in my list. I've added a screenshot if that helps?

Excel problem.fw.png - Google Drive

I thought an IF function might do it, but I want to place each value in to the cell and see the output, not check a cell equals a value.

I really don't want to have to do this manually as it'll potentially take about as long as I've already spent trying not to do it manually!

Typical engineering student eh..?

If I've just confused you, please do say and I'll try to explain it better.

Mik
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Ok, try this:
In this example:
A2 = input
B2 = output
D2 down = input list
E2 down = output list, it’s the result generated by the code
The formula in B2 ‘=A2*20’



Please use Code Tags when posting a code. Like this: [CODE ]Your Code Here[/ CODE]
Code:
[B][COLOR=Royalblue]Sub[/COLOR][/B] a1018625a[B]()[/B]
[B][COLOR=Royalblue]Dim[/COLOR][/B] i [B][COLOR=Royalblue]As[/COLOR][/B] [B][COLOR=Royalblue]Long[/COLOR][/B][B],[/B] va
   
    Application.ScreenUpdating [B]=[/B] [B][COLOR=Royalblue]False[/COLOR][/B]
    Application.Calculation [B]=[/B] xlCalculationManual
 
 
    va [B]=[/B] Range[B]([/B][B][COLOR=brown]"E2"[/COLOR][/B][B],[/B] Cells[B]([/B]Rows.count[B],[/B] [B][COLOR=brown]"E"[/COLOR][/B][B]).[/B][B][COLOR=Royalblue]End[/COLOR][/B][B]([/B]xlUp[B]))[/B]
   
    [B][COLOR=Royalblue]For[/COLOR][/B] i [B]=[/B] [B][B][COLOR=crimson]1[/COLOR][/B][/B] [B][COLOR=Royalblue]To[/COLOR][/B] UBound[B]([/B]va[B],[/B] [B][B][COLOR=crimson]1[/COLOR][/B][/B][B])[/B]
        Range[B]([/B][B][COLOR=brown]"A2"[/COLOR][/B][B])[/B] [B]=[/B] va[B]([/B]i[B],[/B] [B][B][COLOR=crimson]1[/COLOR][/B][/B][B])[/B]
        Range[B]([/B][B][COLOR=brown]"B2"[/COLOR][/B][B]).[/B]Calculate
        Range[B]([/B][B][COLOR=brown]"F"[/COLOR][/B] [B]&[/B] i [B]+[/B] [B][B][COLOR=crimson]1[/COLOR][/B][/B][B])[/B] [B]=[/B] Range[B]([/B][B][COLOR=brown]"B2"[/COLOR][/B][B])[/B]
    [B][COLOR=Royalblue]Next[/COLOR][/B]
 
    Application.ScreenUpdating [B]=[/B] [B][COLOR=Royalblue]True[/COLOR][/B]
    Application.Calculation [B]=[/B] xlCalculationAutomatic
 
[B][COLOR=Royalblue]End[/COLOR][/B] [B][COLOR=Royalblue]Sub[/COLOR][/B]


Excel 2007 32 bit
[TABLE="class: head"]
<tbody>[TR="bgcolor: Darkslateblue"]
[TH][/TH]
[TH]
A
[/TH]
[TH]
B
[/TH]
[TH]
C
[/TH]
[TH]
D
[/TH]
[TH]
E
[/TH]
[TH]
F
[/TH]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
1
[/TD]
[TD="bgcolor: lightgreen"]input[/TD]
[TD="bgcolor: lightgreen"]output[/TD]
[TD="bgcolor: lightgreen"][/TD]
[TD="bgcolor: lightgreen"][/TD]
[TD="bgcolor: lightgreen"]input list[/TD]
[TD="bgcolor: lightgreen"]output list[/TD]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
2
[/TD]
[TD]
10​
[/TD]
[TD]
200​
[/TD]
[TD][/TD]
[TD][/TD]
[TD]
1​
[/TD]
[TD="bgcolor: yellow"]
20​
[/TD]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
3
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
2​
[/TD]
[TD="bgcolor: yellow"]
40​
[/TD]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
4
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
3​
[/TD]
[TD="bgcolor: yellow"]
60​
[/TD]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
5
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
4​
[/TD]
[TD="bgcolor: yellow"]
80​
[/TD]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
6
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
5​
[/TD]
[TD="bgcolor: yellow"]
100​
[/TD]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
7
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
6​
[/TD]
[TD="bgcolor: yellow"]
120​
[/TD]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
8
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
7​
[/TD]
[TD="bgcolor: yellow"]
140​
[/TD]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
9
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
8​
[/TD]
[TD="bgcolor: yellow"]
160​
[/TD]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
10
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
9​
[/TD]
[TD="bgcolor: yellow"]
180​
[/TD]
[/TR]
[TR="bgcolor: white"]
[TD="bgcolor: Darkslateblue"]
11
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
10​
[/TD]
[TD="bgcolor: yellow"]
200​
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="class: grid"]
<tbody>[TR]
[TD]Sheet: Sheet2[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Thanks for the help, although I haven't used Visual Basic before, so I was reduced to following an online tutorial how to use it.

It seemed to just give me a list of unrelated numbers after I altered it, so I gave up and did it the long way around.

Thanks anyway!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top