Hello - I am simply trying to update the value of a retail price, based on the sales price, for a large number of products. I am hoping to use some sort of randomization so that the retail prices don't simply show the same number marked up for every single product.
So, as an example, I am hoping to have the below (somewhat random) results for 5 sample products:
(1) Sale price of $36, Retail price (calculated value) of $49.99
(2) Sale price of $78, Retail price (calculated value) of $109.95
(3) Sale price of $79, Retail price (calculated value) of $99.99
(4) Sale price of $32, Retail price (calculated value) of $69.95
(5) Sale price of $15, Retail price (calculated value) of $19.99
I created a nested if formula that will probably work. It uses a random value column that I have assigned to each product (so that it marks up a different number depending on whether the random value is between .01 and .25 or between .26 and .5 or between .51 and .75 or between .76 and .99 (i.e, four different markup).
However, when I run the query I am getting an Exceed Resources Error. This is probably because I am overcomplicating things a bit, or perhaps because using a nested if formula is too difficult for Access's resource limitations.
Does anyone know of a better way for me to accomplish this result? Is there a way to simplify the formula or perhaps to use an array or "pricing table" of some sort.
(Feel free to ignore this next paragraph if it is too much detail. If it helps, here is the formula that I created. The formula I used also sets a smaller markup for products that have a lower set retail price and a larger markup for products that have a higher set retail price. I can't simply use the set "original" retail price because many times the current price is HIGHER than the original retail price...and thus I have a need to increase the retail price. It is also preferable that the retail prices is rounded to a 10 (such as 39.99 or 39.95 as opposed to something like 36.99). For clarity, the InputRetail price shown in the formula is the original retail price (which I am happy to use whenever it is at least 30% higher than the sale price (i.e., "aprice"). That is what is happening in the first part of my formula which is essentially using the Original retail price (i.e., Input Retail) whenever it is significantly higher than the Sale Price. But if that step is confusing/complicating things, I am okay to ignore the original Input Retail price and just use a simplified markup formula.)
Thanks for any suggestions to help me simplify this formula or to somehow achieve the desired result (i.e. of simply marking up the prices to a higher, somewhat random retail price).
IIf(([inputretail]-[aprice]>20) and [inputretail]<50,[inputretail],IIf(([inputretail]-[aprice]>50) and [inputretail]>50,[inputretail],iif(([[inputretail]<45) and([Rand]<.25),10*Round(([FinalABWPrice]+20)/10,0)-0.05,iif(([[inputretail]<45) and([Rand]<.5),10*Round(([FinalABWPrice]+30)/10,0)-0.01,iif(([[inputretail]<45) and([Rand]<.75),10*Round(([FinalABWPrice]+20)/10,0)-0.01,iif(([[inputretail]<45) and([Rand]<.25),10*Round(([FinalABWPrice]+30)/10,0)-0.05,iif(([[inputretail]<5000) and([Rand]>.75),10*Round(([FinalABWPrice]+70)/10,0)-0.05,iif(([[inputretail]<5000) and([Rand]<.5),10*Round(([FinalABWPrice]+90)/10,0)-0.01,iif(([[inputretail]<5000) and([Rand]<.75),10*Round(([FinalABWPrice]+100)/10,0)-0.01,iif(([[inputretail]<5000) and([Rand]>.75),10*Round(([FinalABWPrice]+80)/10,0)-0.05,10*Round(([FinalABWPrice]+110)/10,0)-0.05)))))))))