Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default excel b74=b74+1 when b4-b54 ="Y"

i want to add 1 to b74 each time any cell b4-b54 is equal to "Y".
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default excel b74=b74+1 when b4-b54 ="Y"

Hi lisa_p -

For an instantaneous count, you could use the following formula in cell B74:

=COUNTIF(B4:B54,"Y")

If you want to add counts the count already in cell B74, you could try the
following VB procedu

Sub lisa_p()
Range("B74") = Range("B74") + _
WorksheetFunction.CountIf(Range("B4:B54"), "Y")
End Sub

--
Jay

"lisa_p" wrote:

i want to add 1 to b74 each time any cell b4-b54 is equal to "Y".

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default excel b74=b74+1 when b4-b54 ="Y"

One way:

=COUNTIF(B4:B54,"Y")

In article ,
lisa_p wrote:

i want to add 1 to b74 each time any cell b4-b54 is equal to "Y".

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default excel b74=b74+1 when b4-b54 ="Y"

You can't have a function reference itself. This is called circular
reference. What you can do is a worksheet change function that can detect
when either B4 or B54 is changed. I didn't know what "Y" was so I changed it
to 34

Sub worksheet_change(ByVal Target As Range)

If Target.Row = 4 And Target.Column = 2 Then
If ActiveSheet.Cells(4, 2) - ActiveSheet.Cells(54, 2) = 34 Then
ActiveSheet.Cells(74, 2) = ActiveSheet.Cells(74, 2) + 1
End If
End If
If Target.Row = 54 And Target.Column = 2 Then
If ActiveSheet.Cells(4, 2) - ActiveSheet.Cells(54, 2) = 34 Then
ActiveSheet.Cells(74, 2) = ActiveSheet.Cells(74, 2) + 1
End If
End If

End Sub




"lisa_p" wrote:

i want to add 1 to b74 each time any cell b4-b54 is equal to "Y".

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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! [email protected] Excel Discussion (Misc queries) 3 January 5th 07 02:18 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 03:56 PM.

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

About Us

"It's about Microsoft Excel"