Conditionally format last row of matching criteria

K

KKD

I want to create an underline border for a row containing a particular value.

Example:
(Headers) PO# Inv# Amt Status
(Data) ABC 123 $50.12 Multiple
ABC 456 $47.00 Multiple
AXX 789 $21.00

In this example, I want an underline to appear under the last data row that
contains a repeated PO#. So an underline would appear under the middle row,
because that is the last row of the "ABC" PO#. However, I do NOT want
underlines to appear under rows that only have a single PO#.

The status column is set up to read "multiple" if there are multiple rows
using that PO# and the status is blank if it is a single occurrence. The rows
are usually sorted by PO#.
 
S

Sheeloo

I think you want the line only when Status in the current row is 'Multiple'
and the status in next row is blank...

Assuming you have headers and your data starts at row 2... select the range
you want to underline starting at second row and use the
FORMULA IS in Conditional Formatting as
=AND($D2="Multiple",$D3="")
and choose the Underline format
 
B

Bernard Liengme

This conditional formatting formula worked for me (I selected A2:D100)
=AND(COUNTIF($A$2:$A$100,$A2)>1,COUNTIF(A2:$A$100,$A2)=1)
best wishes
 
K

KKD

The problem with that formula is that if there are two PO#s next to each
other they do not get separated.

Example:

Example:
(Headers) PO# Inv# Amt Status
(Data) ABC 123 $50.12 Multiple
ABC 456 $47.00 Multiple
AXX 789 $21.00 Multiple
AXX 987 $15.00 Multiple

With the suggested formula, no line would appear under second line, even
though it is the final row containing "ABC", because the next row is also a
multiple, but it is a new PO#.
 
S

Sheeloo

Try
=NOT(AND($D2="Multiple",$D3="Multiple"))
KKD said:
The problem with that formula is that if there are two PO#s next to each
other they do not get separated.

Example:

Example:
(Headers) PO# Inv# Amt Status
(Data) ABC 123 $50.12 Multiple
ABC 456 $47.00 Multiple
AXX 789 $21.00 Multiple
AXX 987 $15.00 Multiple

With the suggested formula, no line would appear under second line, even
though it is the final row containing "ABC", because the next row is also a
multiple, but it is a new PO#.
 
J

Jarek Kujawa

insert the following conditional formatting formula for A2
=COUNTIF($A$2:A2,A2)=COUNTIF($A$2:$A$100,A2)

then copy->pastespecial->Formats

HIH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top