Highlight consecutive duplicate cells

oalessia

New Member
Joined
May 8, 2012
Messages
12
Dear all,

I woukld like to use conditional formatting in excel to highlight only consecutive duplicate cells.

for example if:

A1 4
A2 5
A3 5
A4 7
A6 5
A7 8

I would like only cells A2 and A3 to be highlighted, but if I use the 'highlight duplicate cells' command I get also A6. can anyone help me?

Thank you.

alessia
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
You can create two rules:

rule 1: =if(a1=a2,true,false)
and set the highlight format when true
rule 2: =if(a2=a1,true,false)
and set the highlight format when true

Then, apply the rules to the range of the cells you want.
 
Upvote 0
Oops! I screwed it. Should be

=if(a2=a1,true,false)
=if(a2=a3,true,false)
 
Upvote 0
Oops! I screwed it. Should be

=if(a2=a1,true,false)
=if(a2=a3,true,false)

Hi YKY,

thank you for your reply. I must be doing something wrong because now it highlighted all the cells!

here is what I did: in 'conditional formatting' > new formatting rule > use a formula to determine... > format values where this formula is true: =if(a2=a1,true,false) =if(a2=a3,true,false)

then in the format tab I selected highlight 'yellow'
OK

Any help would be greatly appreciated.

thanks
Alessia
 
Upvote 0
Hi YKY,

thank you for your reply. I must be doing something wrong because now it highlighted all the cells!

here is what I did: in 'conditional formatting' > new formatting rule > use a formula to determine... > format values where this formula is true: =if(a2=a1,true,false) =if(a2=a3,true,false)

then in the format tab I selected highlight 'yellow'
OK

Any help would be greatly appreciated.

thanks
Alessia
Are you creating two rules?
 
Upvote 0
You could try something like....

Code:
=OR(A2=A1,A2=A3)

This takes for granted that your list of values starts in A2 so you'd need to shift your column down

Similar setup in conditional formatting but should only require one rule

Make sure you select the range prior to applying the formatting.
 
Upvote 0
You could try something like....

Code:
=OR(A2=A1,A2=A3)

This takes for granted that your list of values starts in A2 so you'd need to shift your column down

Similar setup in conditional formatting but should only require one rule

Make sure you select the range prior to applying the formatting.

It works! thank you very much.
best,
Alessia
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,827
Members
449,470
Latest member
Subhash Chand

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