How to use Evaluate for roundup or ceiling in range

alee001

Board Regular
Joined
Sep 9, 2014
Messages
137
Office Version
  1. 2010
Platform
  1. Windows
Hello, I don't know to compile Evaluate() to roundup or ceiling in range as following code, Anyone tips for me?
VBA Code:
Sub sample2()
Cells(3, 13).Resize(10, 3).Value = Evaluate("I3:K12" & "/" & 1.2 & "+" & 0.4)
Cells(3, 13).Resize(10, 3).Value = Evaluate("ROUND(" & "I3:K12" & "/" & 1.2 & "+" & 0.4 & ",3)") 'how to roundup?
Cells(3, 13).Resize(10, 3).Value = Evaluate("CEILING(" & "I3:K12" & "/" & 1.2 & "+" & 0.4 & ",0.02)") 'how to ceiling?
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,942
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
Cells(3, 13).Resize(10, 3).Value = Evaluate("CEILING(I3:K12/1.2+0.4,0.02)")
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,942
Office Version
  1. 365
Platform
  1. Windows
Does work...
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,942
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

+Fluff 1.xlsm
EFGHIJKLMNO
1
2From macro
371.2497.942.08851175071.2497.942.08
4112.9166.2427.0813519932112.9166.2427.08
527.998.7430.4331183627.998.7430.4
6162.0827.990.419433108162.0827.990.4
7103.749.5840.41241148103.749.5840.4
8106.24109.58161.24127131193106.24109.58161.24
9161.248.74107.0819310128161.248.74107.08
10150.4129.58116.24180155139150.4129.58116.24
11154.5875.4152.0818590182154.5875.4152.08
12149.58122.930.417914736149.58122.930.4
Main
Cell Formulas
RangeFormula
E3:G12E3=CEILING(I3/1.2+0.4,0.02)
I3:K12I3=RANDARRAY(10,3,10,200,1)
Dynamic array formulas.
 

alee001

Board Regular
Joined
Sep 9, 2014
Messages
137
Office Version
  1. 2010
Platform
  1. Windows
+Fluff 1.xlsm
EFGHIJKLMNO
1
2From macro
371.2497.942.08851175071.2497.942.08
4112.9166.2427.0813519932112.9166.2427.08
527.998.7430.4331183627.998.7430.4
6162.0827.990.419433108162.0827.990.4
7103.749.5840.41241148103.749.5840.4
8106.24109.58161.24127131193106.24109.58161.24
9161.248.74107.0819310128161.248.74107.08
10150.4129.58116.24180155139150.4129.58116.24
11154.5875.4152.0818590182154.5875.4152.08
12149.58122.930.417914736149.58122.930.4
Main
Cell Formulas
RangeFormula
E3:G12E3=CEILING(I3/1.2+0.4,0.02)
I3:K12I3=RANDARRAY(10,3,10,200,1)
Dynamic array formulas.
+Fluff 1.xlsm
EFGHIJKLMNO
1
2From macro
371.2497.942.08851175071.2497.942.08
4112.9166.2427.0813519932112.9166.2427.08
527.998.7430.4331183627.998.7430.4
6162.0827.990.419433108162.0827.990.4
7103.749.5840.41241148103.749.5840.4
8106.24109.58161.24127131193106.24109.58161.24
9161.248.74107.0819310128161.248.74107.08
10150.4129.58116.24180155139150.4129.58116.24
11154.5875.4152.0818590182154.5875.4152.08
12149.58122.930.417914736149.58122.930.4
Main
Cell Formulas
RangeFormula
E3:G12E3=CEILING(I3/1.2+0.4,0.02)
I3:K12I3=RANDARRAY(10,3,10,200,1)
Dynamic array formulas.
All answer are 1.24?
test.jpg
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
60,127
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

All answer are 1.24?
Sounds like you may have your calculation mode set to "Manual".

Does this make a difference?
VBA Code:
Sub Test()
    Application.Calculation = xlCalculationAutomatic
    Cells(3, 13).Resize(10, 3).Value = Evaluate("CEILING(I3:K12/1.2+0.4,0.02)")
End Sub
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,942
Office Version
  1. 365
Platform
  1. Windows
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Not sure if this will work on your version, but try
VBA Code:
Cells(3, 13).Resize(10, 3).Value = Evaluate("if({1},CEILING(I3:K12/1.2+0.4,0.02))") 'how to ceiling?
 
Solution

alee001

Board Regular
Joined
Sep 9, 2014
Messages
137
Office Version
  1. 2010
Platform
  1. Windows
Manual or Automatic is same ans.?
I used to Excel2010 with Win7.
 

alee001

Board Regular
Joined
Sep 9, 2014
Messages
137
Office Version
  1. 2010
Platform
  1. Windows
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Not sure if this will work on your version, but try
VBA Code:
Cells(3, 13).Resize(10, 3).Value = Evaluate("if({1},CEILING(I3:K12/1.2+0.4,0.02))") 'how to ceiling?
Ah! this code OK. Why do I need to add {1} (if) to be valid? Thanks a lot
 

Forum statistics

Threads
1,148,193
Messages
5,745,272
Members
423,941
Latest member
CluelessAboutExcel

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
Top