By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,391 Members | 1,429 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,391 IT Pros & Developers. It's quick & easy.

sum with if statement

P: 20
Hello,

Im trying to use an If statement to do calculations. What im trying to do is this,

i have 3 text boxes. One called style, quantity and sum. What i would like is when a certain style is entered, then in the some field it displays an answer from a sum.

The statement i have been using is
If Style = "Crew" Then
Sum = "Quantity*0.35"
End If

But i dont get the answer of the sum, instead i get "Quantity*0.35"
Where im i going wrong? Can anyone help me please
Aug 7 '07 #1
Share this Question
Share on Google+
1 Reply


P: 47
First of all make sure Sum and Quantity are both defined as numbers.
When you enclose it in quotes it implies it's a string (text). Only Style should be text and as you don't need quotes around numbers, your formula should read as shown below

<code>vb
If Style = "Crew" Then
Sum = Quantity*0.35
End If
</code>
Aug 7 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.