price calculation

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
786
Office Version
  1. 365
hi,

I have products that have price per box and per unit,

for example box price is $64 in the box has 9 units so the price per unit is $7.11.

the problem is the in the report i have it times it by box price but some products are deliver per unit so the price should be calculated by unitprice not price box in the report.

my question is:

how can i do a iif condition formula to to check if is price box or unit price?

I have this but it's not working:


Code:
=IIf([UNIT]="EACH",Sum([UnitCost]*[Quantity]),Sum([UnitPrice]*[Quantity]))
thank you
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Remove the SUM() code like this:

=IIf([UNIT]="EACH",[UnitCost]*[Quantity],[UnitPrice]*[Quantity])

This will give you what you're looking for.
 
Upvote 0
Thank you.

When printed the report works but only on the product by each and the other ones shows error so only calculate the each ones.

thanks
 
Upvote 0
Are you basing your report off a query? If so, post your SQL statement for your query. If you are basing your report directly off a table, consider changing it to running a query first.

Alan
 
Upvote 0
Thank you.

here my sql query, yes i am basing the report on this query and i put the calculation on a textbox.

Code:
SELECT tblPurchaseOrders.PONumber, tblPurchaseOrders.PODate, tblPurchaseOrderDetails.fkPurchaseOrderID, tblPurchaseOrderDetails.fkProductID, tblPurchaseOrders.pkInvoiceNumber, tblPurchaseOrderDetails.Quantity, tblProducts.UNIT, tblProductCategories.Category, tblProducts.vpCode, tblProducts.UnitPrice, tblProducts.ProductName, tblProductCategories.PrintFlag, +[UnitPrice]/[QuantityPerUnit] AS UnitCost
FROM tblPurchaseOrders INNER JOIN (tblProductCategories INNER JOIN (tblProducts INNER JOIN tblPurchaseOrderDetails ON tblProducts.pkProductID = tblPurchaseOrderDetails.fkProductID) ON tblProductCategories.pkProductCategoryID = tblProducts.pkProductCategoryID) ON tblPurchaseOrders.pkPurchaseOrderID = tblPurchaseOrderDetails.fkPurchaseOrderID
WHERE (((tblPurchaseOrders.PODate)>=[forms]![ReportDateRange4]![BeginDate] And (tblPurchaseOrders.PODate)<=[forms]![ReportDateRange4]![EndDate]));

thanks
 
Upvote 0

Forum statistics

Threads
1,224,514
Messages
6,179,219
Members
452,895
Latest member
BILLING GUY

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