# Compare 1 price against multiple prices and change the price according to a formula

1. ## Compare 1 price against multiple prices and change the price according to a formula

Hello everybody,

Thank you so much for your previous and continuous help. I have an issue that I think it needs a sort of excel function but I don't know how to do it, I have a table, let's say columns D, I, J, K, L, M, N, O, P and they all have different prices, what I need to do is to compare the very first price in D2, against every other price cell, starting with I2, and see: if D2 is smaller than I2, then let D2 be = the price in I2 - 0.50 , otherwise, if D2 is larger than I2 within the limit of 2.50 (that is to say, larger with the amount from 0.001 to the amount 2.50), then let D2 be = the price of I2 - 0.20 , and if D2 is larger than I2 with more than 2.50, then totally leave I2, and compare the price in D2 against the price in the next cell which is J2, if D2 is smaller than J2, then let D2 be smaller than J2 with only 0.50 , otherwise if D2 is larger than J2 within the limit of 2.50 (that is to say, larger with the amount from 0.001 to the amount 2.50), then let D2 be = the price of J2 - 0.20 , and if D2 is larger than J2 with more than 2.50, then leave J2, and compare the price in D2 against the price in K2, .. and so on until the condition comes true
After that it would be preferable to color the cell (I, J, K, L, M, N, O, P) where the condition comes true, with a red bold font or yellow highlight cell or .. etc

Many thanks
Charlie

2. ## Re: Compare 1 price against multiple prices and change the price according to a formula

Pop up a sample workbook that has all this laid out already. Make sure the sample has 3-4 examples where you've mocked up the answers in column D manually and highlighted the match cells, if it's not obvious.

Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.

3. ## Re: Compare 1 price against multiple prices and change the price according to a formula

Hi JBeaucaire

Thanks a lot. I attached a sample sheet. There are 2 more columns (Q, R) to consider as well.
And the results will be calculated by the formula and placed in a new column, I would appreciate your recommendation.

Many thanks
Charlie

4. ## Re: Compare 1 price against multiple prices and change the price according to a formula

Hello JBeaucaire,

There is a little change in the required task, I rephrased the task:

Columns D, I, J, K, L, M, N, O, P, Q, R and they all have different prices, what I need to do is to compare the very first price in D2, against every other price cell, starting with I2, and see: if D2 is smaller than I2, then let D2 be = the price in I2 - 0.50 , otherwise, if D2 is larger than I2, then totally leave I2, and compare the price in D2 against the price in the next cell which is J2, if D2 is smaller than J2, then let D2 be smaller than J2 with only 0.50 , otherwise if D2 is larger than J2, then leave J2, and compare the price in D2 against the price in K2, .. and so on until the condition comes true.
After that it would be preferable to color the cell where the condition comes true within (I, J, K, L, M, N, O, P, Q, R), with a red bold font or yellow highlight cell or .. etc

Many thanks
Charlie

5. ## Re: Compare 1 price against multiple prices and change the price according to a formula

You didn't indicate where you wanted this formula, so in F2 put this array formula:

=IFERROR(INDEX(I2:R2, MATCH(TRUE, (\$I2:\$R2<\$D2), 0))-0.5, \$D2)

... confirmed by pressing CTRL-SHIFT-ENTER to activate the array. You will see curly braces { } appear around your formula to indicate an active array.

The part in red is the array, it is running that formula over and over for each cell in \$I2:\$R2 to see if any of them are less then D2. If so, TRUE results there, and it will return that position back to the INDEX. The INDEX is the same cells, I2:R2, so it results in that number being returned. Then .50 cents is deducted and that's your answer.

If none of the cells is less then D2, it results in an error, and the IFERROR converts the error back into the D2 as the default price.

After entering the formula as an array in cell F2, copy F2 down as needed.

6. ## Re: Compare 1 price against multiple prices and change the price according to a formula

Dear JBeaucaire,

I tried your formula, in S, but it gives the same values in D.
Attached is a clearer sample with the desired results in S

Thank you in advance
Charlie

7. ## Re: Compare 1 price against multiple prices and change the price according to a formula

OOPS, read the operator wrong, switch the < to >.

=IFERROR(INDEX(I2:R2, MATCH(TRUE, (\$I2:\$R2>\$D2), 0))-0.5, \$D2)

8. ## Re: Compare 1 price against multiple prices and change the price according to a formula

Dear JBeaucaire

Thank you so much for your help, now it worked, I am truly grateful and appreciate that. Have a wonderful day.

Charlie

9. ## Re: Compare 1 price against multiple prices and change the price according to a formula

@ CharlieAziz

Thanks.

Also, as an infrequent user of the forum, you may have forgotten (or may not be aware) that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

10. ## Re: Compare 1 price against multiple prices and change the price according to a formula

Dear Cutter,

Thank you for taking care of this. I already submitted a thanks approval after I clicked on the star, and I was just leaving the page open to continue all necessary actions then I just got busy with something, but I will take more care next times, and I appreciate your help. Have a wonderful day.

Charlie

##### Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1