VBA Help for Formulas

zaska

Well-known Member
Joined
Oct 24, 2010
Messages
1,046
Hello,

I am using the following two formulas and i kindly request anyone to help me to write a macro for the same.

=PERCENTRANK(B$2:B$500,B2)

=AND(D2>=PERCENTILE(D$2:D$500,0.17),D2<=PERCENTILE(D$2:D$500,0.42))

Thank you
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hello,

I am using the following two formulas and i kindly request anyone to help me to write a macro for the same.

=PERCENTRANK(B$2:B$500,B2)

=AND(D2>=PERCENTILE(D$2:D$500,0.17),D2<=PERCENTILE(D$2:D$500,0.42))

Thank you


you can call most worksheet functions in VBA, an example of vlookup is below


=VLOOKUP(123,A1:C100,3,FALSE)

To use code in VBA that does the same thing, you would use:


Dim Res As VariantRes = Application.WorksheetFunction.VLookup(123,Range("A1:C100"),3,FALSE)</PRE>
 
Upvote 0
Do you want the macro to enter the formulas or do you it to enter the results?

In what cell or cells do want the formulas (or results) entered?
 
Upvote 0
To record a macro that creates the formulas, do this:

Start the macro recorder
Select the first cell with the formula that you want to record
Press {F2} then {TAB}
Select the next formula cell and repeat.

That will write a macro creating the formulas.
To fill those down is straightforward but I need to know the layout of your worksheet.
To convert them to values afterwards you can copy the formulas, then paste special > values.

Denis
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

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