How to highlight the last cell based on other column value

New Contributor



I want to highlight the last value in column B based on the name of the company and if the last value for the company is 0 or empty, no highlight will be done. I tried to use a formula in conditional formatting but with no success. (See below the table and the formula I used)


Conditional Formatting formula: 





In A2 the value is Apple. I want the conditional formatting to check for the value "Apple" (And this will be done for all the values in column A) and get the last value (in A5) and highlight the value in column B (144). When the last value is equal 0, all the highlights will disappear. But if the last value is empty in column B, it will look for another cell with a value and if there is no cell with a value, no highlight will be done.


I hope my request is clear, and thank you for your effort.





2 Replies
best response confirmed by Khalid0090 (New Contributor)


Does this conditional formatting formula do what you want?




Yes, it worked! Thanks a lot.