Please help me how i can write it using if function
overbook cost: if showing up > capcity, then difference between showing up and capcity * overbook cost, otherwise =0 profit=revenue-variable cost-overbookcost)
Please help me how i can write it using if function
overbook cost: if showing up > capcity, then difference between showing up and capcity * overbook cost, otherwise =0 profit=revenue-variable cost-overbookcost)
Hi Afnan and welcome to the Forum.
As Don says (in the second linked tutorial below), the IF function has 3 parts ":
=IF(logical_test, [value_if_true], [value_if_false])
The last two arguments have brackets around them because they are optional; if you leave them blank, they will just output the values True or False as a result of the function."
Your question is a little confusing but if I ignore from "profit=" onwards, then in the attached sample spreadsheet, you can change the values in following cells (shaded yellow):
and B6 has the IF formula:
=IF(B4>B2,(B4-B2)*B3,0)
where the central bit in bold is the (True) value if "Showing up" is greater than "Capacity" i.e. the difference between those numbers (B4-B2) multiplied by the "Overbook cost" B3. The brackets mean that difference number is calculated before the multiplication.
You just need to change the cell references to suit your case and put values into your new cells.
To learn more about IF, see Don's tutorial 15 IF Statement Examples in Excel. If you need to put an IF function within another ("nest" them) then see Nest IF Statements in Excel
Hope this helps.