Chintu M.

asked • 08/13/21

How to highlight first and last row of each group in excel?

Below is an extract of my Excel data

A 20160101
A 20160104
A 20160105
A 20160106
A 20160107
AA 20160108
AA 20160111
AA 20160112
AA 20160113
AA 20160114
AA 20160115
AA 20160118
AB 20160119
AB 20160120
AB 20160121
AB 20160122
AB 20160125
AB 20160126
AB 20160127
AB 20160128

like I HAVE over 10,000+ rows

I want to highlight these rows

a 20160101
a 20160107
aa 20160108
aa 20160118
ab 20160119
ab 20160128


Please give me step by step solution


3 Answers By Expert Tutors

By:

Alex F. answered • 11/05/21

Tutor
5 (33)

A lifetime of experience

Patrick B. answered • 08/13/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Chintu M.

If I have 28 of field what I will do?
Report

08/13/21

Patrick B.

Bob is suggesting that you create a third column which earmarks the occurrence of the last of one group and the first one another. You can then use conditional formatting to highlight as you described. The problem is these markers shall need to be changed if a new row is added at the end. For example in your data the row A 20160107 will have a 1, and the next row AA 20160108 will have a 2. The problem is if you add another row like A 20160109 BEFORE the first row of AA 20160108 then you will have to move the 1 and 2 markers accordingly. In contrast the code I wrote for you checks to see when the group name changes and outputs the two rows to another file. So the filtering is done for you.
Report

08/14/21

Patrick B.

let me know what you want to do, I can assist with either solution
Report

08/14/21

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.