Formulas, Convert to VBA Script

jrwrita

Board Regular
Joined
May 7, 2015
Messages
206
Hi all,

I have a bunch of repetitive formulas I use in my sheets.

For example, I place this formula in column EE:2 on sheet "database". I dont want the formula in any of the cells as I have to do other stuff in the cells that this would normally return a #N/A. So I just want to place the result of the below vlookup in the cells that it applies too.

Can anyone help me form this into a vba code? I have about 16 of these, from EE:ET.

Code:
IF(AND(OR($BM:$BM="Equity|Public",$BM:$BM="Equity|Private",$BM:$BM="Pref Shares"),$BN:$BN<>"Excel",$BN:$BN<>"ITS"),$AT:$AT*(IFNA(VLOOKUP(EE$1&$S:$S,EQ_Shocks!E:F,2,FALSE),VLOOKUP(EE$1&"OTHERS",EQ_Shocks!E:F,2,FALSE))-1),"")

Any help would be appreciated, Thanks.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
which cells does it apply to ?
You could also adapt the formula to not show anything if the result would be N/A, so....

I think we need more information !!!
 
Upvote 0
Applies to the whole of column EE2:EE6000. but all my formulas apply to the full range would be EE2:ET6000.
 
Upvote 0
So I asked
which cells does it apply to ?
in response to this statement

I dont want the formula in any of the cells as I have to do other stuff in the cells that this would normally return a #N/A.
 
Last edited:
Upvote 0
Sorry, it applies to the conditions in the formulas.
ie if in column BM = Equity Private , etc then write to EE2, loop through each row.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

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