English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need a macro for the cells in Excel that will take whatever number I put into it (ex. 200), multiply it by 2, and add 40 to it. So for 200, I need it to let me put that number in a cell, multiply it to get 400, then add 40, for a total of 440, and display 440 in the box.I suck at Excel, so any help would me most appreciated.

2006-09-18 06:36:14 · 5 answers · asked by dragonfuror 2 in Computers & Internet Software

5 answers

If you put 200 in cell A1, put the following in cell B1:
=A1*2+40

The result in B1 will be 440

2006-09-18 06:43:40 · answer #1 · answered by f 3 · 1 0

Not sure about a macro but you can use a separate column with the formulas. For example, this function below will look at the value of cell A8 and put your answer (times 2 plus 40) into B8:

=IF(A8=0,,(A8*2)+40)

If A8 is blank it will leave B8 as a blank. You can copy this formula to multiple cells in the column and it will change the numbers for you. E.g., if you are in B8 then click and hold the top right corner of the cell and drag down to however many cells you need.

2006-09-18 13:50:51 · answer #2 · answered by BrianR 2 · 0 0

No macro needed for this situation. What you need to do is go to another cell in your spreadsheet and type in =((Cell#*2)+40)

In the place of Cell# you need to click on the cell you want to apply this equation to. If the cell you are working on is B12 then the equation will end up looking like this: =((B12*2)+40)

If you want to do this to multiple cells in a column then you can mouse over the bottom of the box with the equation in it which will turn your mouse cursor into a cross or plus sign. Drag the mouse down the page to the last row of the column you are applying this equation to and let go. The equation will be copied to all the rows in the next column substituting the cell# for each cell in the column you are applying this to.

2006-09-18 13:46:14 · answer #3 · answered by donethat 3 · 0 0

You only really need a Macro for this if you intend to use it over a large number of cells.

For such a simply function and equation would be best.

Something like: =(a2*2) + 40

Put that in a cell and it does what you want with the numeric value in cell A2.

2006-09-18 13:45:23 · answer #4 · answered by Taztug 5 · 0 0

If by "box" you mean a pop-up message box, then you need a one line macro which you can run whenever you're in the cell with an input number:

MsgBox "The answer is " & ActiveCell.Value * 2 + 40

You can navigate to the editor where you edit macros by recoding a fake macro (Tools->Macro->Record Macro) and then selecting "Edit" for that macro from Tools->Macro->Macro. Replace whatever you've "recorded" with the one line I told you about.

Good luck. I hope that's what you're looking for.

2006-09-18 15:18:37 · answer #5 · answered by curious1223 3 · 0 0

fedest.com, questions and answers