Decrease value by fixed percentage across columns

w0kkie

New Member
Joined
Mar 26, 2020
Messages
7
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
  2. MacOS
  3. Mobile
Hello! I have an interesting situation I've been poking at for a few days now to no avail, so it would be great if anyone else has tackled a similar problem before and knows of an elegant solution.

Here's the situation:
I have a table, let's say 10row x 8col. The rows represent a list of products, and cols represent the sale year.
Each product(row) has a starting price (price it starts at). The list of starting prices is one cell over, in the same rows.
There are two cells I need to be able to set manually, which are: Reduction amount (percentage), and reduction length (number of years the reduction should continue for).

I've gotten halfway there by using a numerical index and comparing it to the reduction duration value, which gets the the behavior I want as far as applying to price reductions for the correct number of years, but it only works if I start all the prices on year 1. I'm stuck on how to get some products to start on different years, leaving preceding years blank, and still have the price reduction logic behave correctly.

One last caveat - I can't use macros, because some users of this sheet are not permitted to "enable macros" on a workbook while having certain other files open, which is common.

For visual reference, here's an example of how it would look if it were working properly:
Correct Pricing Table.PNG


And here's how it looks now, as far as I've been able to get:
Current Pricing Table.PNG


You can see the cell references and the formula I'm using in the screenshot, but for convenience here it is in text as well. Cell F5 contains:
Code:
=IF($C$2-E$3>0,E5*(1-$C$3),E5)

I appreciate any ideas!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Here is one approach:
Cell Formulas
RangeFormula
E5:K12E5=IF(RIGHT($D5,LEN($D5)-3)=RIGHT(E$4,LEN(E$4)-5),$C5,IF(RIGHT(E$4,LEN(E$4)-5)<RIGHT($D5,LEN($D5)-3),"",IF(COLUMNS($E5:E5)-1<RIGHT($D5,LEN($D5)-3)+LEFT($C$2,LEN($C$2)-4),D5*(1-$C$3),D5)))
 
Upvote 0
Here is one approach:

Hi KRice, thanks for the reply. I tried that formula in the range, and it correctly sets the first year price for each row. More progress.!

Unfortunately though, every other cell gets a #VALUE! error. I applied the formula to cell E5, and then auto-filled to the right and then down. I also pasted it across the entire range E5:K12. Same result any way I spin it. Any ideas?
 
Upvote 0
Here's what it looks like after applying the formula: (showing cell F5 highlighted, same as before)
Current Pricing Table_sol1.PNG
 
Upvote 0
Yes, generally it's a bad idea to mix the number you want to use with a word (or units) in the same cell. That requires some extra effort to extract the number of interest. In your recent post, I suspect the issue is related to cell C2. Note in your original post, you had "3 Yrs" with a space between 3 and Yrs. In this recent post, you have "3yrs", so the formula isn't correctly extracting the "3". Try adding a space and see if that fixes the problem.
 
Upvote 0
Figured it out! The cell C2 contains the value "3" in my sheet, using custom formatting to display "yrs" after the cell value. Once I inspected your formula more closely I realized you were considering the cell C2 to contain the value "3 yrs". Once I realized that, I just switched up the cell formatting to test it, and it works!

I'll change it up based on the custom formatting rules that the sheet has, and I should be set. Thank you (y)
 
Upvote 0
Not to put too fine of a point on it, but here is a slightly revised version that eliminates the compound numbers/words...and the formula is greatly simplified:
Cell Formulas
RangeFormula
E5:K12E5=IF($D5=E$4,$C5,IF(E$4<$D5,"",IF(COLUMNS($E5:E5)-1<$D5+$C$2,D5*(1-$C$3),D5)))
 
Upvote 0
Thanks for the feedback and the additional detail...I'm glad you got it working. I missed the small difference (the space in C2) in the two examples in your original post, but in this case, that space matters.
 
Upvote 0
Thanks for the clarification! Looks like we both posted at about the same time, haha.

And I agree, I generally avoid mixing characters in a cell if it's used as a reference, which is why in the actual sheet I'm working with the values are numerical only, and the characters are appended using custom cell formatting, just to improve readability and keep the table compact without having too many header rows/columns or notes for the user.

In the example tables I created for my original post, I made one tiny oversight, as you pointed out above - one of the tables had the custom formatting with a number, as my real sheet does, and the other was simply typed in the cell.
 
Upvote 0
This version assumes layout like the OP, with "Red.Dur" in A1 and "yr 1" in column C.

=IF(RIGHT($C4,1)=RIGHT(D$3,1),$B4, L4*(1-IF((RIGHT(D$3,1)+0)<=(RIGHT($C4,1)+LEFT($B$1,1)),$B$2,0)))
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,044
Members
449,063
Latest member
ak94

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