If you have 500 items, in column B, but only 20 of them are unique invoices due to them being broken up into purchase orders. It makes sense to keep them separate so you can more easily reconcile checks that are written to you.
The solution I came up with involves using the custom-formula for conditional formatting.
If column A is the Purchase-Order Numbers ( that are entirely unique ) and column B are your invoices that repeat multiple times. Assuming you have headers in row 1.
Explanation of Solution
UNIQUE() is an array returning formula that is exclusive to google sheets (it does not work in excel). This allows you to figure out how many unique invoices exist within column B. So
UNIQUE($B$2:$B) returns a list of only the unique numbers, removing all duplicates.
MATCH() returns an integer of where an item is located in a 1 dimensional range or array. I used it to look at each item in column B and find it's location within the array created by
UNIQUE($B$2:$B) ; SO
MATCH($B2,UNIQUE($B$2:$B),0) will look at cell
B2, and find where it is located in
UNIQUE($B$2:$B) and return a number that represents which place it is in the list.
FALSE depending on the number you give it. For Instance
ISODD(1) will return
TRUE. So if we wrap
ISODD() around our match-unique formula it will alternate with
FALSE per each different invoice. SO,