Do I need convert formula into vba?

Raelantorm

New Member
Joined
Oct 19, 2009
Messages
2
Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p></o:p>
I have written a formula to calculate an average price, plus or minus commission, if the values in each column conform to the following criteria: <o:p></o:p>
If column B = AH, C = Buy and F = 3 MONTH, add 1 to the averaged price.<o:p></o:p>
If column B = AH, C = Sell and F = 3 MONTH, minus 1 from the averaged price.<o:p></o:p>
<o:p></o:p>
=IF(F:F="3 MONTH",G:G*D:D) <o:p></o:p>
AH Ave Buy =SUMPRODUCT(($B2:$B$9999="AH")*($C2:$C$9999="Buy")*($I$2:$I$9999)*($F2:$F9999="3 MONTH"))/SUMPRODUCT(($B2:$B$9999="AH")*($C2:$C$9999="Buy")*($D$2:$D$9999)*($F2:$F9999="3 MONTH"))+1<o:p></o:p>
AH Ave Sell =SUMPRODUCT(($B2:$B$9999="AH")*($C2:$C$9999="Sell")*($I$2:$I$9999)*($F2:$F9999="3 MONTH"))/SUMPRODUCT(($B2:$B$9999="AH")*($C2:$C$9999="Sell")*($D$2:$D$9999)*($F2:$F9999="3 MONTH"))-1<o:p></o:p>
<o:p></o:p>
This only works if I paste the formula directly into the workbook, but I would like this info to be stored in a Macro. The problem is that because I have pasted it, the Macro only shows "ActiveSheet.Paste". This is why I think I need to convert the formula to vba.
<o:p></o:p>
Any help here would be most welcome, as I have been pulling my hair out trying to get it to work! <o:p></o:p>
<o:p></o:p>
Btw, I am very new to excel formulas/macros and may be missing something obvious. Apologies if I seem like a noob!<o:p></o:p>
<o:p></o:p>
Thanks,<o:p></o:p>
Rae<o:p></o:p>
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Welcome to the board!

If you just want to record entry of that formula, then turn on the macro recorder, copy the formula (i.e., click into the cell and copy the whole formula), click *into the cell* and paste the formula, then press enter. That way the recorder sees you entering a new formula, not pasting... it may also work to turn on the recorder, press F2 and then enter on a cell that already has the formula.

Hope that helps.

Tai
 
Upvote 0
I can't believe it was that simple!!!!
Where have you been for the last seven hours ;)

Thank you very very very very much....

Cheers,

Rae
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,659
Members
449,091
Latest member
peppernaut

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