ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Create Calucated Field in a Userform (https://www.excelbanter.com/excel-discussion-misc-queries/265502-create-calucated-field-userform.html)

robinsn

Create Calucated Field in a Userform
 
Hello

I have created a userform with approx 10 fields. 3 of the fields are numeric where a number is entered. These fields a

No of Hours
Rate Per Hour
Tonnes

I have created a field which is calcuation of the above as follows:

Customer ABC (This customer pays for the tonnes)

No. of Hours = 10
Rate Per Hour = $100
Tonnes = 2

The charge to the customer for each tonne is $50 per tonne

The calculated field is called "Amount to Charge customer" The calcuatation is [10 x $100] + [2 x $50] = $1,100

I can put a formula into the field "Amount Charged to Customer" as shown above. However, there is a further compliation in that some customers do not pay for tonnes. For example:

Customer XYZ (This customer does not pay for the tonnes)

No. of Hours = 8
Rate Per Hour = $100
Tonnes = 2

The calculated field is called "Amount to Charge customer" The calcuatation for Customer XYZ is [8 x $100] + [0 x $50] = $800

In my userform, I have about 100 customers. 95 of the customers pay for the tonnes like Customer ABC with only 5 of them who do not pay for the tonnes like Customer XYZ.

Is there a VB code I can use that would calculate the correct amount for each customer in each situation?

Any feedback would be helpful.

Thanks


All times are GMT +1. The time now is 01:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com