If / And / Or Formula

markmogli

New Member
Joined
Dec 20, 2019
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Hello, I'm after some expert help:

My spreadsheet has some sales forecast / actual data in it. I sell products with a fluctuating price based on demand.

A1 is is the product.

B1 is the 1st price I put a product on sale for.

F1 is the gross profit margin formula.

After a few weeks on sale, the price may be adjusted to reflect demand, either up or down.

C1 is the second price the product is priced at. I now need F1 to update the GP on the new selling price.

I may change the price a 2nd time, entering the new price into D1. I now need F1 to update the GP based on the new selling price.

I may change the price a 3rd and final time, entering the new price into E1, I now need F1 to update the GP on the new selling price.

It's driving me bat $%^& crazy - I've tried various IF / AND / AND/OR and I'm getting bogged down in nestled IF's which may be the wrong route....?

Argh!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
What is the current formula in cell F1, just based on the B1 entry?
 
Upvote 0
You can nest the IF portion, i.e.
=IF(E1<>"",use E1 in formula,IF(D1<>"",use D1 in formula,IF(C1<>"",use C1 in formula,use B1 in formula)))

There might be a way to simplify it, but without seeing your exact formula, I cannot say that for sure.
 
Upvote 0
You can nest the IF portion, i.e.
=IF(E1<>"",use E1 in formula,IF(D1<>"",use D1 in formula,IF(C1<>"",use C1 in formula,use B1 in formula)))

There might be a way to simplify it, but without seeing your exact formula, I cannot say that for sure.
The formula in F1 is just (B1-Z1)/B1 (where Z1 is the item cost and B1 is the revenue. It's just the revenue may change to that of data in C1 or indeed D1.
 
Upvote 0
OK, then just substitute into my format:
=IF(E1<>"",(E1-Z1)/E1,IF(D1<>"",(D1-Z1)/D1,IF(C1<>"",(C1-Z1)/C1,(B1-Z1)/B1)))
 
Upvote 0
OK, then just substitute into my format:
=IF(E1<>"",(E1-Z1)/E1,IF(D1<>"",(D1-Z1)/D1,IF(C1<>"",(C1-Z1)/C1,(B1-Z1)/B1)))

Hi Joe,

That formula does indeed work, however; it only works when data is entered in to one cell.

I would like to leave the data entered in to cells E1, D1 & C1 so I can see the price changing over time.

How can this formula be adapted to allow this?

Thanks,
 
Upvote 0
I would like to leave the data entered in to cells E1, D1 & C1 so I can see the price changing over time.

How can this formula be adapted to allow this?
I am afraid I don't follow you. Can you work us through an actual example?

Note that a formula can only return one single value at a time. If you want to see multiple values, you will want to use multiple formulas in multiple cells.
If that is the case, then all you really need is a calculation for each cell, i.e.
=(B1-Z1)/B1 in one cell,
=(C1-Z1)/C1 in another cell,
etc.
 
Upvote 0
I am afraid I don't follow you. Can you work us through an actual example?

Note that a formula can only return one single value at a time. If you want to see multiple values, you will want to use multiple formulas in multiple cells.
If that is the case, then all you really need is a calculation for each cell, i.e.
=(B1-Z1)/B1 in one cell,
=(C1-Z1)/C1 in another cell,
etc.



Book1.xlsx
BCDEFG
230-Nov01-Dec02-Dec
3CostPrice 1Price 2Price 3GP
4Item 1£1.00£10.0090%
5Item 2£2.00£5.00£10.0080%
6Item 3£3.00£13.00£8.00£5.0040%
Sheet1
Cell Formulas
RangeFormula
G4G4=(D4-C4)/D4
G5G5=(E5-C5)/E5
G6G6=(F6-C6)/F6


Hopefully this helps. The formulas in column G need to look at column D first and give me a GP. When I decide to change the price, as on "item 2", the GP will change based on the new selling price, so the formula now needs to look in E5 instead of D5.
 
Upvote 0
Oh, you are putting them on different rows.
You just need to take the original formula I gave you, and copy the formula down for all rows.

So put this formula in cell G4:
=IF(E4<>"",(E4-Z4)/E4,IF(D4<>"",(D4-Z4)/D4,IF(C4<>"",(C4-Z4)/C4,(B4-Z4)/B4)))
and copy down to row G6.
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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