Ceiling using VBA code

sudi

New Member
Joined
Jun 8, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I need to add a vba code for ceiling along with vlookup worksheet function. Can anyone please help?
This is my code line:
Worksheets("sheets").Cells(i, 24).Value = Worksheets("sheets").Cells(i, 21).Value / Application.WorksheetFunction.VLookup(Worksheets("sheets").Cells(i, 18).Value, Worksheets("sheets").Range("A:L"), 7, 0)
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Welcome to the Board!

Sometimes, instead of ovecomplicating things, and trying to cram everything into one long formula, it makes more sense to split it up into smaller pieces.
So, you could do the VLOOKUP portion of the calculation, and store it to a variable.
Then you could perform the CEILING calculation based on that variable and assign the value to your cell.

If you still need more assistance, it would be helpful if you post a sample of your data and expected output.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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