View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default Conditional Formatting for an unknown range

Ok, try this:

Assumptions:

There will *always* be a Stop1 and a Stop2.
There will *never* be duplicate Stops. Like 2 instances of Stop1 or Stop2.

Select the *entire* range that you want to format starting from cell A1. If
you don't know how many rows of data you'll have then select a range that is
larger than you will ever use (but not too large!). In the formulas I'm
suggesting I use the range from A1:A20. Adjust the end of that range as
needed.

Conditional Formatting
Condition 1
Formula Is:

=ROW(A1)<MATCH("stop1",A:A)

Click the Format button
Select the Patterns tab
Select a nice shade of YELLOW
OK

Click the Add button

Condition 2
Formula Is:

=AND(ROW(A1)MATCH("stop1",A:A,0),ROW(A1)<MATCH("s top2",A:A,0))

Click the Format button
Select the Patterns tab
Select a nice shade of BLUE
OK

Click the Add button

Condition 3
Formula Is:

=AND(ROW(A1)MATCH("stop2",A:A,0),ROW(A1)<=MAX((A$ 1:A$20<"")*ROW(A$1:A$20)))

Click the Format button
Select the Patterns tab
Select a nice shade of GREEN
OK out

If you test these formulas *on the worksheet* the formula for condition 3 is
an array formula. Array formulas are entered differently (on the worksheet)
than a regular formula. After you type in a regular formula you hit the
ENTER key. With an array formula you *must* use a combination of keys. Those
keys are the CTRL key, the SHIFT key and the ENTER key. That is, hold down
both the CTRL key and the SHIFT key then hit the ENTER key.

When done properly Excel will enclose the formula in squiggly brackets { }.
You can't just type these brackets in, you *must* use the key combo to
produce them. Also, anytime you edit an array formula it *must* be
re-entered as an array using the key combo.

--
Biff
Microsoft Excel MVP


"BaseballFan" wrote in message
...
"T. Valko" wrote:

In other words, you want to format cells that *don't contain the word
StopX"

Sort of... I want to make the first range yellow, the second range blue,
and
the third range green. The first range will be A1:xx23 (xx being 1 row
above
wherever the first "Stop" text might be). The second range will be
yy1:zz25
(yy being 1 row below the first "Stop" text, and zz being 1 row above
wherever the 2nd "Stop" might be)

Another "hard" part is that there will not be a "final" 'Stop' text. I
want
to highlight the 3rd range of data after the 2nd "Stop" text, but finish
highlighting at the final row of data.

Thanks.
Jim

Select the *entire* range of cells starting from cell A1.
Goto the menu FormatConditional Formatting
Select the Formula Is option
Enter this formula in the box on the right:
=COUNTIF(A1,"stop*")=0
Click the Format button
Select the desired style(s)
OK out

--
Biff
Microsoft Excel MVP


"BaseballFan" wrote in message
...
I'd like to conditionally format a range of cells, but the range is
dynamic.
For instance, I'd like to format A1:A20, but I only know to stop at A20
because cell A21 has the text "Stop1". I'd then like to format
A22:A40,
but
I only know to start at A22 and stop at A40 because it's after the
Stop1
A41
has the text "Stop2".

Where "Stop1" and "Stop2" are actually at is dynamic... Stop1 may
appear
at
A5 on a short list of items, but may go all the way down to A100 on a
longer
list.

Essentially, I'd like to format downward until I hit that "Stop#"
value,
and
then start again until I hit the next stop value.