I need help to understand VBA questions!

emafouanamy

New Member
Joined
Aug 24, 2014
Messages
6
Im only looking for help on a bunch of questions and I am going to be posting them one at a time upon explanation of why that is the answer. I actually want to understand the reason behind so if you can help, thank you very much?

Question 1

Given that A=12, B=13, Z=3 at the start of the following program what vale does 'A' have at the end of the program?

  • Z=(A+2) - (B+3)
  • A= A - B + (2*Z)
  • B=-B
  • A=(Z-(2*24)) * (A-B)
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Simply substitute the values for the variables and the answer will be self evident !
We generally don't assist homework or assignments.
 
Upvote 0
I did that and it still gives the wrong answer! (Is it bad for me to get help on assignment questions cause I dont want the answers. I want the steps behind)
 
Upvote 0
I think the concept that that question is addressing is the assignment of variables. Those formulas should not be interpreted as equations.
The first one, Z=(A+2) - (B+3). Does not imply that Z + (B+3) = (A+2)

it is an instruction to the computer to calculate the value of (A+2) - (B+3) and then assign that value to the variable Z.

Edit: what is the wrong answer that you got and how did you arrive at that answer.
 
Upvote 0
What did you get and what did you expect ??
 
Upvote 0
Basically I went down the formulas equating for Z and A then changed B to negative when inputing it into the last formula. I came out with an answer of -587
 
Upvote 0
Basically I went down the formulas equating for Z and A then changed B to negative when inputing it into the last formula. I came out with an answer of -587
 
Upvote 0
As Mike stated, it's an excercise in changing variable values.
Have you tried actually doing each equation on a worksheet...
If you put the variables in cells and refer to them in each formula, you should achieve the desired outcome
 
Upvote 0
As Mike stated, it's an excercise in changing variable values.
Have you tried actually doing each equation on a worksheet...
If you put the variables in cells and refer to them in each formula, you should achieve the desired outcome

Ok ill check that out? I am going post another question if that is fine?
 
Upvote 0
Question 2

What value will 'X' have when this loop completes?

X=0
A=0
While A < 10

  • X=X + A
  • A=A + 1
wend

I said 0

Any thoughts?
 
Upvote 0

Forum statistics

Threads
1,214,586
Messages
6,120,402
Members
448,958
Latest member
Hat4Life

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