Change formatting at each change of ID

Twilkes

New Member
Joined
Nov 1, 2012
Messages
5
I like some of the table autoformatting from Excel 2007, especially the way it alternates colours on different rows, so people can follow along the rows easily.

But is there an easy way to format a table so that the colour is not changed on each row, but only when the contents of a certain field change, like an ID? Example below.

Would I need to set up a macro for this or is there something built into Excel that would do this?

IDData
1A
1B
1C
2D
2E
3F
4G
5H
5I

<COLGROUP><COL style="WIDTH: 48pt" span=2 width=64><TBODY>
</TBODY>
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Thanks that's a good tip, I'd not considered that.

I've got it working by adding another column that checks whether the ID above the previous one is different, and if it is, it adds 1 to a running count. So the running count for the first ID is 1, the next goes up to 2, then 3 etc. I then do a conditional format on the running count, using MOD(cell,2) to determine whether it's odd or even, and changing the colour of all the odd ones.

So it works, but is there a way to do it without adding in the running total column? The IDs are alphanumeric, like KRG154, KEH872, GTD292, so it's difficult to do anything meaningful on them.

Thanks,
 
Upvote 0

Forum statistics

Threads
1,215,235
Messages
6,123,784
Members
449,124
Latest member
shreyash11

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