Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Formula for CF

Dear All,

I have a range of cells. (a1 to az1) these cells will be input with D/S or
N/S for shifts, what I need is a CF format to highlight the cells and bold if
more than 4 D/S are in a row such as D/S D/S D/S D/S D/S in cells A1 A2 A3 A4
A5 these will highlight a colour and bold and the same for N/S also. can
anyone help me on this small problem.

many thanks.

MN
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Formula for CF

One way, using a helper row...

In row 2 (insert a new row 2 if necessary), enter this formula in B2:
=IF(B1=A1,A2+1,1)
Copy B2 to the right through AZ2.

Select row 1. Select Format Conditional Formatting. Change 'Cell Value
Is' to 'Formula Is', and enter the formula
=(A24)
Click the Format button and select the formatting you want. Click OK and OK
to close the Conditional Formatting dialog. You can hide row 2 if desired.

Hope this helps,

Hutch

"santaviga" wrote:

Dear All,

I have a range of cells. (a1 to az1) these cells will be input with D/S or
N/S for shifts, what I need is a CF format to highlight the cells and bold if
more than 4 D/S are in a row such as D/S D/S D/S D/S D/S in cells A1 A2 A3 A4
A5 these will highlight a colour and bold and the same for N/S also. can
anyone help me on this small problem.

many thanks.

MN

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Formula for CF

Besides the formula in B2, you should enter the number 1 in cell A2.

Hutch

"Tom Hutchins" wrote:

One way, using a helper row...

In row 2 (insert a new row 2 if necessary), enter this formula in B2:
=IF(B1=A1,A2+1,1)
Copy B2 to the right through AZ2.

Select row 1. Select Format Conditional Formatting. Change 'Cell Value
Is' to 'Formula Is', and enter the formula
=(A24)
Click the Format button and select the formatting you want. Click OK and OK
to close the Conditional Formatting dialog. You can hide row 2 if desired.

Hope this helps,

Hutch

"santaviga" wrote:

Dear All,

I have a range of cells. (a1 to az1) these cells will be input with D/S or
N/S for shifts, what I need is a CF format to highlight the cells and bold if
more than 4 D/S are in a row such as D/S D/S D/S D/S D/S in cells A1 A2 A3 A4
A5 these will highlight a colour and bold and the same for N/S also. can
anyone help me on this small problem.

many thanks.

MN

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Formula for CF

this should do it

Sub formats()

Range("a1").Select
Do Until ActiveCell.Value = ""
Dim v1 As String
Dim v2 As String
Dim v3 As String
Dim v4 As String
Dim v As String
v1 = ActiveCell.Value
v2 = ActiveCell.Offset(1, 0).Value
v3 = ActiveCell.Offset(2, 0).Value
v4 = ActiveCell.Offset(3, 0).Value
v5 = v1 & v2 & v3 & v4
If v5 = "d/sd/sd/sd/s" Then
Range(ActiveCell.Address, ActiveCell.Offset(3, 0)).Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
ElseIf v5 = "n/sn/sn/sn/s" Then
Range(ActiveCell.Address, ActiveCell.Offset(3, 0)).Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Else

End If
ActiveCell.Offset(1, 0).Activate
Loop

End Sub

"santaviga" wrote:

Dear All,

I have a range of cells. (a1 to az1) these cells will be input with D/S or
N/S for shifts, what I need is a CF format to highlight the cells and bold if
more than 4 D/S are in a row such as D/S D/S D/S D/S D/S in cells A1 A2 A3 A4
A5 these will highlight a colour and bold and the same for N/S also. can
anyone help me on this small problem.

many thanks.

MN

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Formula for CF

Hi Tom, Tried this but returning false figures further along the line, I
thought of AND function in CF with some sort of formula in there. Any further
ideas??

MN

"Tom Hutchins" wrote:

Besides the formula in B2, you should enter the number 1 in cell A2.

Hutch

"Tom Hutchins" wrote:

One way, using a helper row...

In row 2 (insert a new row 2 if necessary), enter this formula in B2:
=IF(B1=A1,A2+1,1)
Copy B2 to the right through AZ2.

Select row 1. Select Format Conditional Formatting. Change 'Cell Value
Is' to 'Formula Is', and enter the formula
=(A24)
Click the Format button and select the formatting you want. Click OK and OK
to close the Conditional Formatting dialog. You can hide row 2 if desired.

Hope this helps,

Hutch

"santaviga" wrote:

Dear All,

I have a range of cells. (a1 to az1) these cells will be input with D/S or
N/S for shifts, what I need is a CF format to highlight the cells and bold if
more than 4 D/S are in a row such as D/S D/S D/S D/S D/S in cells A1 A2 A3 A4
A5 these will highlight a colour and bold and the same for N/S also. can
anyone help me on this small problem.

many thanks.

MN



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Formula for CF

Are the 'false figures' caused by blank cells? If so, try this formula in B2:
=IF(AND(B1=A1,LEN(B1)0),A2+1,1)
Copy across through AZ1.

I don't see a way to do all this just using a conditional formatting formula
(with no helper row), but I will keep experimenting.

Hutch

"santaviga" wrote:

Hi Tom, Tried this but returning false figures further along the line, I
thought of AND function in CF with some sort of formula in there. Any further
ideas??

MN

"Tom Hutchins" wrote:

Besides the formula in B2, you should enter the number 1 in cell A2.

Hutch

"Tom Hutchins" wrote:

One way, using a helper row...

In row 2 (insert a new row 2 if necessary), enter this formula in B2:
=IF(B1=A1,A2+1,1)
Copy B2 to the right through AZ2.

Select row 1. Select Format Conditional Formatting. Change 'Cell Value
Is' to 'Formula Is', and enter the formula
=(A24)
Click the Format button and select the formatting you want. Click OK and OK
to close the Conditional Formatting dialog. You can hide row 2 if desired.

Hope this helps,

Hutch

"santaviga" wrote:

Dear All,

I have a range of cells. (a1 to az1) these cells will be input with D/S or
N/S for shifts, what I need is a CF format to highlight the cells and bold if
more than 4 D/S are in a row such as D/S D/S D/S D/S D/S in cells A1 A2 A3 A4
A5 these will highlight a colour and bold and the same for N/S also. can
anyone help me on this small problem.

many thanks.

MN

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Formula for CF

That has done the trick. many thanks Hutch

Mark

"Tom Hutchins" wrote:

Are the 'false figures' caused by blank cells? If so, try this formula in B2:
=IF(AND(B1=A1,LEN(B1)0),A2+1,1)
Copy across through AZ1.

I don't see a way to do all this just using a conditional formatting formula
(with no helper row), but I will keep experimenting.

Hutch

"santaviga" wrote:

Hi Tom, Tried this but returning false figures further along the line, I
thought of AND function in CF with some sort of formula in there. Any further
ideas??

MN

"Tom Hutchins" wrote:

Besides the formula in B2, you should enter the number 1 in cell A2.

Hutch

"Tom Hutchins" wrote:

One way, using a helper row...

In row 2 (insert a new row 2 if necessary), enter this formula in B2:
=IF(B1=A1,A2+1,1)
Copy B2 to the right through AZ2.

Select row 1. Select Format Conditional Formatting. Change 'Cell Value
Is' to 'Formula Is', and enter the formula
=(A24)
Click the Format button and select the formatting you want. Click OK and OK
to close the Conditional Formatting dialog. You can hide row 2 if desired.

Hope this helps,

Hutch

"santaviga" wrote:

Dear All,

I have a range of cells. (a1 to az1) these cells will be input with D/S or
N/S for shifts, what I need is a CF format to highlight the cells and bold if
more than 4 D/S are in a row such as D/S D/S D/S D/S D/S in cells A1 A2 A3 A4
A5 these will highlight a colour and bold and the same for N/S also. can
anyone help me on this small problem.

many thanks.

MN

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Formula for CF

Hi, Need a little more help on this one, input the macro but when 5 x D/S in
a row and macro run doesn't do anything, any suggestions.

regards


Mark

"dmoney" wrote:

this should do it

Sub formats()

Range("a1").Select
Do Until ActiveCell.Value = ""
Dim v1 As String
Dim v2 As String
Dim v3 As String
Dim v4 As String
Dim v As String
v1 = ActiveCell.Value
v2 = ActiveCell.Offset(1, 0).Value
v3 = ActiveCell.Offset(2, 0).Value
v4 = ActiveCell.Offset(3, 0).Value
v5 = v1 & v2 & v3 & v4
If v5 = "d/sd/sd/sd/s" Then
Range(ActiveCell.Address, ActiveCell.Offset(3, 0)).Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
ElseIf v5 = "n/sn/sn/sn/s" Then
Range(ActiveCell.Address, ActiveCell.Offset(3, 0)).Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Else

End If
ActiveCell.Offset(1, 0).Activate
Loop

End Sub

"santaviga" wrote:

Dear All,

I have a range of cells. (a1 to az1) these cells will be input with D/S or
N/S for shifts, what I need is a CF format to highlight the cells and bold if
more than 4 D/S are in a row such as D/S D/S D/S D/S D/S in cells A1 A2 A3 A4
A5 these will highlight a colour and bold and the same for N/S also. can
anyone help me on this small problem.

many thanks.

MN

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Formula for CF

send me an email and i will forward u the file i am using

"santaviga" wrote:

Hi, Need a little more help on this one, input the macro but when 5 x D/S in
a row and macro run doesn't do anything, any suggestions.

regards


Mark

"dmoney" wrote:

this should do it

Sub formats()

Range("a1").Select
Do Until ActiveCell.Value = ""
Dim v1 As String
Dim v2 As String
Dim v3 As String
Dim v4 As String
Dim v As String
v1 = ActiveCell.Value
v2 = ActiveCell.Offset(1, 0).Value
v3 = ActiveCell.Offset(2, 0).Value
v4 = ActiveCell.Offset(3, 0).Value
v5 = v1 & v2 & v3 & v4
If v5 = "d/sd/sd/sd/s" Then
Range(ActiveCell.Address, ActiveCell.Offset(3, 0)).Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
ElseIf v5 = "n/sn/sn/sn/s" Then
Range(ActiveCell.Address, ActiveCell.Offset(3, 0)).Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Else

End If
ActiveCell.Offset(1, 0).Activate
Loop

End Sub

"santaviga" wrote:

Dear All,

I have a range of cells. (a1 to az1) these cells will be input with D/S or
N/S for shifts, what I need is a CF format to highlight the cells and bold if
more than 4 D/S are in a row such as D/S D/S D/S D/S D/S in cells A1 A2 A3 A4
A5 these will highlight a colour and bold and the same for N/S also. can
anyone help me on this small problem.

many thanks.

MN

  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Formula for CF

just sent an email to you.

many thanks

"dmoney" wrote:




"santaviga" wrote:

Hi, Need a little more help on this one, input the macro but when 5 x D/S in
a row and macro run doesn't do anything, any suggestions.

regards


Mark

"dmoney" wrote:

this should do it

Sub formats()

Range("a1").Select
Do Until ActiveCell.Value = ""
Dim v1 As String
Dim v2 As String
Dim v3 As String
Dim v4 As String
Dim v As String
v1 = ActiveCell.Value
v2 = ActiveCell.Offset(1, 0).Value
v3 = ActiveCell.Offset(2, 0).Value
v4 = ActiveCell.Offset(3, 0).Value
v5 = v1 & v2 & v3 & v4
If v5 = "d/sd/sd/sd/s" Then
Range(ActiveCell.Address, ActiveCell.Offset(3, 0)).Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
ElseIf v5 = "n/sn/sn/sn/s" Then
Range(ActiveCell.Address, ActiveCell.Offset(3, 0)).Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Else

End If
ActiveCell.Offset(1, 0).Activate
Loop

End Sub

"santaviga" wrote:

Dear All,

I have a range of cells. (a1 to az1) these cells will be input with D/S or
N/S for shifts, what I need is a CF format to highlight the cells and bold if
more than 4 D/S are in a row such as D/S D/S D/S D/S D/S in cells A1 A2 A3 A4
A5 these will highlight a colour and bold and the same for N/S also. can
anyone help me on this small problem.

many thanks.

MN

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regression Leverage Formula (Jerry W. Lewis or Mike Middleton)already have DFITS formula PJ[_3_] Excel Worksheet Functions 2 June 2nd 10 03:45 PM
Excel 2002 Formula: Urgent Conditional Formula Required Right Away - if possible blue[_2_] Excel Discussion (Misc queries) 2 July 11th 07 06:08 PM
Formula expected end of statement error, typing formula into cell as part of VBA macro [email protected] Excel Programming 1 July 20th 06 07:58 PM
Excel 2002 formula displayed not value formula option not checked Dean Excel Worksheet Functions 1 February 28th 06 02:31 PM
Commenting custom formula fields/formula on formula editor Muxer Excel Programming 2 July 24th 03 01:02 AM


All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"