Make formula to return whole numbers

mari_hitz

Board Regular
Joined
Jan 25, 2011
Messages
101
Hi!

I would like an advice regarding a code that I have. I would like that this formula to return me a whole number, instead of a number with a lot of decimals.
I have tried to put the "Integer" code but it did not gave me any results, because if the formula returned before the "integer" a number such as 97.777777, after I put the "Integer" it returned me 8. I would need the formula to return me 98 or 97.
I do not know if I am making any sense, but I let you here the code I have:

Code:
Private Sub Total_GotFocus()
End Sub
Private Sub Writting_LostFocus()
Total.Text = (Val(Writting.Text) * 2 / 9) + (Val(Vocabulary.Text) * 1 / 9) + (Val(Accuracy.Text) * 2 / 9) + (Val(Professionalism) * 2 / 9) + (Val(Ownership.Text) * 1 / 9) + (Val(Siebel_Processes) * 2 / 9)
End Sub
Private Sub Vocabulary_LostFocus()
Total.Text = (Val(Writting.Text) * 2 / 9) + (Val(Vocabulary.Text) * 1 / 9) + (Val(Accuracy.Text) * 2 / 9) + (Val(Professionalism) * 2 / 9) + (Val(Ownership.Text) * 1 / 9) + (Val(Siebel_Processes) * 2 / 9)
End Sub
Private Sub Accuracy_LostFocus()
Total.Text = (Val(Writting.Text) * 2 / 9) + (Val(Vocabulary.Text) * 1 / 9) + (Val(Accuracy.Text) * 2 / 9) + (Val(Professionalism) * 2 / 9) + (Val(Ownership.Text) * 1 / 9) + (Val(Siebel_Processes) * 2 / 9)
End Sub
Private Sub Professionalism_LostFocus()
Total.Text = (Val(Writting.Text) * 2 / 9) + (Val(Vocabulary.Text) * 1 / 9) + (Val(Accuracy.Text) * 2 / 9) + (Val(Professionalism) * 2 / 9) + (Val(Ownership.Text) * 1 / 9) + (Val(Siebel_Processes) * 2 / 9)
End Sub
Private Sub Ownership_LostFocus()
Total.Text = (Val(Writting.Text) * 2 / 9) + (Val(Vocabulary.Text) * 1 / 9) + (Val(Accuracy.Text) * 2 / 9) + (Val(Professionalism) * 2 / 9) + (Val(Ownership.Text) * 1 / 9) + (Val(Siebel_Processes) * 2 / 9)
End Sub
Private Sub Siebel_Processes_LostFocus()
Total.Text = (Val(Writting.Text) * 2 / 9) + (Val(Vocabulary.Text) * 1 / 9) + (Val(Accuracy.Text) * 2 / 9) + (Val(Professionalism) * 2 / 9) + (Val(Ownership.Text) * 1 / 9) + (Val(Siebel_Processes) * 2 / 9)
End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Thanks for your help AMAS.
I have tried with those too but they do not work.
What I am trying to make whole number is the result of a calculator that I have created in Excel with text boxes, so I can not select any range such as A1, for example.
I do not know if what I am asking if possible, please let me know if I need to post more information.
 
Upvote 0
Hi,

You can use it in a formula. Example:

Code:
=10/3

can be rounded by using both the Round and Text functions as follows:

Code:
=ROUND(10/3,0)

Code:
=TEXT(10/3,"0")

AMAS
 
Upvote 0
You can use the similar methods in VBA too:

Total.Text = INT(rest of your formula)

or

Total.Text = round(rest of your formula,0)
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,248
Members
452,900
Latest member
LisaGo

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