Convert Excel formula to VBA - keeping relative and absolute references

fluru

New Member
Joined
Jan 21, 2016
Messages
13
Dear all!

I am trying to reduce the processing time of a worksheet that contains the following formula.

The constants need to remain constant but the rest will have to reflect the position in the worksheet e.g. as it would if the formula were copied across columns.

=IF(AND($K10>=X$4,$K10<Y$4),$K$6,IF(X$3="XSD","Xmas",IF(AND($L10>=X$4,$L10<Y$4),$L$6,IF(AND($M10>=X$4,$M10<Y$4),$M$6,IF(AND($N10>=X$4,$N10<Y$4),$N$6,IF(AND($O10>=X$4,$O10<Y$4),$O$6,IF(AND($P10>=X$4,$P10<Y$4),$P$6,IF(AND($S10>=X$4,$S10<Y$4),$S$6,IF(AND($R10>=X$4,$R10<Y$4),$R$6,IF(AND($Q10>=X$4,$Q10<Y$4),$Q$6,IF(OR(Y10=$K$6,Y10=$L$6,Y10=$M$6,Y10=$N$6,Y10=$O$6,Y10=$P$6),SUM(MAX(Y10:AE10)+1),IF(AND(Y10>0,Y10<10),SUM(MAX(Y10:AE10)+1),IF(Y10="Aircon","",IF(Y10="","",IF(AND(Y10="Xmas",Z10="Xmas",OR(AA10="",AA10="Aircon")),"",SUM(MAX(Y10:AE10)+1))))))))))))))))

Any assistance in converting this into a VBA function would be appreciated :)
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,219,161
Messages
6,146,657
Members
450,706
Latest member
LGVBPP

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