To add a formula from excel to VBA-excel

GirishDhruva

Active Member
Joined
Mar 26, 2019
Messages
308
Hi Everyone,

I am trying to calculate the difference between two values and multiply with payable days and sum up all those values.

Like,

here is my sample formula for one cell
=+ROUND(((C3-AH3)*BM3)/30,0)+ROUND(((C3-AH3)*BM3)/31,0)+ROUND(((C3-AH3)*BM3)/30,0)+ROUND(((C3-AH3)*BM3)/31,0)+ROUND(((C3-AH3)*BM3)/31,0)+ROUND(((C3-AH3)*BM3)/30,0)+ROUND(((C3-AH3)*BM3)/31,0)+ROUND(((C3-AH3)*BM3)/30,0)+ROUND(((C3-AH3)*BM3)/31,0)+ROUND(((C3-AH3)*BM3)/31,0)+ROUND(((C3-AH3)*BM3)/28,0)+ROUND(((C3-AH3)*BM3)/31,0)

here is my sample workbook
https://www.dropbox.com/s/lrkjhs85j3ep3lj/Sum_MrExcel.xlsm?dl=0

In workbook the highlighted header's Column(A,B,C...) will have the formula but that formula shouldn't be viewed in workbook.

From the above formula i need to calculate for each components(A,B,C....... in attached workbook), so if i find for each component the code will become lengthy,so please guide me how i can use the code in VBA.

Can this be done.

Regards,
Dhruva.
 
Last edited:
The -64 is to get the correct column for the autofilter. If B1 had "APR" we would need to autofilter on col BM (which is col 65) so 65-64=1 which is the first field in the autofilter.
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,223,533
Messages
6,172,883
Members
452,486
Latest member
standw01

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