How to Convert MS Excel Formula to VBA Code

Jasmine send us an email with the following query:
I’m learning Excel VBA. How can I convert a standard formula like the one below to Excel VBA?
Please help!!! Thanks

We have discussed the countif function in detail. It counts the items based on a specific criteria. Now let’s see how we can convert this countif function into VBA code. We have also attached the converted code to a command button so that the macro’s use becomes even more user-friendly.

Watch the Excel training video below to see how the conversion of the excel formual to VBA code or macro is done:

3 thoughts on “How to Convert MS Excel Formula to VBA Code”

  1. how to excel vba userform create textbox value insert to empty row and “A to I” merge to columns and this row color and font size change,bold.
    pls., give this ans.

    vishant panchal

  2. =INDEX(DATA!$D$2:$O$19,MATCH($A$2&$C$6,DATA!$B$2:$B$19&DATA!$A$2:$A$19,0),MATCH(A8,DATA!$D$1:$O$1,0),1)

    convert excel formula to VBA

  3. =IFERROR(VLOOKUP($A2,’D:\Mahesh\ATM Master sheet\02-04-2019\[IMPSNTSLAPM020419_1C.xls]IMPSNTSLAPM020419_1C’!$A$6:$D$50,2,0),0)+IFERROR(VLOOKUP($A2,’D:\Mahesh\ATM Master sheet\02-04-2019\[IMPSNTSLAPM020419_2C.xls]IMPSNTSLAPM020419_2C’!$A$6:$D$50,2,0),0)+IFERROR(VLOOKUP($A2,’D:\Mahesh\ATM Master sheet\02-04-2019\[IMPSNTSLAPM020419_3C.xls]IMPSNTSLAPM020419_3C’!$A$6:$D$50,2,0),0)+IFERROR(VLOOKUP($A2,’D:\Mahesh\ATM Master sheet\02-04-2019\[IMPSNTSLAPM020419_4C.xls]IMPSNTSLAPM020419_4C’!$A$6:$D$50,2,0),0)

    How to convert the formaula into VBA

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.