• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel Formula to compare 2 month's price and highlight if there is a change

ravikiran

Member
Hi Gurus,

I need some quick help with a formula. I am trying to compare Product prices between few months, where I need to highlight if the price changed from previous month(s). I pasted few scenarios below:

Current month is 202308
Product A - It is exactly the same for both months - so no Query
Product B - It increased by 1 so I have to highlight it to be queried
Product C - There is 2 previous months for comparison. and it is different - so need to be queried
Product D - Price decreased by 1 - need to be queried.

ProductPriceYearMonthQuery
Product A200202307
Product A200202308
Product B100202307
Product B101202308Query
Product C500202306
Product C449202307
Product C501202308Query
Product D800202307
Product D799202308Query


What is the best way to achieve the above? I tried my hand writing a formula and didn't get it to work as expected. I attached the sample excel file with the same data.

Thanks for your help in advance.

Cheers,
Ravi.
 

Attachments

  • Sample.xlsx
    16.8 KB · Views: 4
maybe a simplier way to do , but i have used

see if that works fro all your scenarios

=IF(AND(COUNTIFS($C$4:$C$12,C4,$D$4:$D$12,D4)<>COUNTIF($C$4:$C$12,C4),MAXIFS($E$4:$E$12,$C$4:$C$12,C4)=E4),"Query","")

if you want you could use in conditional formatting to highlight
AND(COUNTIFS($C$4:$C$12,C4,$D$4:$D$12,$D4)<>COUNTIF($C$4:$C$12,$C4),MAXIFS($E$4:$E$12,$C$4:$C$12,$C4)=$E4),

i have highlighted the cells RED , but could just make bold by changing the formatting

not sure what version of excel you have - so MAXIFS maybe an issue of very old version of excel
 

Attachments

  • Sample-ETAF.xlsx
    17.3 KB · Views: 9
Wow ETAF, that worked perfectly and such a simple logic. I hit myself hard for not thinking that. I just made a minor change to adjust the month automatically as a parameter.

=IF(AND(COUNTIFS($C:$C,C2,$D:$D,D2)<>COUNTIF($C:$C,C2), [@YearMonth]=202208),"Query","")

Can I bother you for another addition, seldom I need to check for those products which differ by a threshold. Sometimes, it might be by 2/5 or even 0.01. Basically I want to highlight only those products which cross that threshold and not those which are within.

Any idea how I might be able to work that out with a formula?

Thanks again for looking into this,
Ravi.
 
Back
Top