TextBox Plus/ Minus/Multiply and Divide Problem

D

Dave Elliott

I have 5 textboxes on my form that I use to calculate formulas
Text406 is used to add hours
Text500 is used for the customer rate
Text411 is used for Material
Text413 multiplies Text411*1.3 for a 30% markup

Finally Text407 is supposed to total them up.

So, you take the total hours(Text406) multiply the # of hours(Text406)
Then add the material(Text413)

The default number of Hours(Text406) is 0
The default Rate(Text500) is 65 ($65.00)
The default material(Text411) is 0

The code below works except for that is shows the customer rate(Text500)
even when there is no hours(Text406)
so that you get $65.00 by default.

What am I missing?
The number of hours divided by 2 is correct by the way (Text406/2)


=NZ([Text406]/2*[Text500]+[Text500]+[Text413],0)
 
J

JP

Well, that's exactly what you wrote in your formula.

When hours are zero, you get the following result:

(Text406/2) * Text500 = 0 (because Text406 is equal to zero)

Add to that the value of Text500, which is $65, gives you $65

Add to that the value of the material (presumably zero) and you still get
$65.

What is it that you were trying to do? Why is Text500 in there twice (once
being multiplied by hours and again being added in at its face value?

Remember, multiplications and divisions are done BEFORE additions and
subtractions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top