price calculation

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
750
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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Phildaburn

Board Regular
Joined
Feb 4, 2011
Messages
146
Remove the SUM() code like this:

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

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

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
750
Office Version
  1. 365
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

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
7,593
Office Version
  1. 365
Platform
  1. Windows
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

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
750
Office Version
  1. 365
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,195,672
Messages
6,011,083
Members
441,581
Latest member
rp4717

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
Top