Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
using countif into a formula
I want to put a formula in a cell, to check if a range of cells
contains one character. I think it seems like ActiveCell.Formula = "=" & "COUNTIF(" & first_cell & ":" & last_cell & ";" & ""P"" & ")" where first_cell and last_cell are the bounds of a range and "P" is the character I want to check if it exists but it does not work |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
using countif into a formula
This worked for me
;-) Dim myRange As Range Dim Formula As String Set myRange = Worksheets("Sheet1").Range("A1:C10") Formula = Application.WorksheetFunction.CountIf(myRange, "P") MsgBox Formula |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
using countif into a formula
One method is:
Sub Frmula() Dim firstcell As String Dim lastcell As String firstcell = Range("A1").Address lastcell = Range("A13").Address Range("B1").Formula = "=COUNTIF(" & firstcell & ":" & lastcell & ",""p"")" End Sub Mike F "fuzzy" wrote in message oups.com... I want to put a formula in a cell, to check if a range of cells contains one character. I think it seems like ActiveCell.Formula = "=" & "COUNTIF(" & first_cell & ":" & last_cell & ";" & ""P"" & ")" where first_cell and last_cell are the bounds of a range and "P" is the character I want to check if it exists but it does not work |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
using countif into a formula
Get the address of the cells, first_cell.address and last_cell.address
-- HTH RP (remove nothere from the email address if mailing direct) "fuzzy" wrote in message oups.com... I want to put a formula in a cell, to check if a range of cells contains one character. I think it seems like ActiveCell.Formula = "=" & "COUNTIF(" & first_cell & ":" & last_cell & ";" & ""P"" & ")" where first_cell and last_cell are the bounds of a range and "P" is the character I want to check if it exists but it does not work |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Countif Formula | Excel Worksheet Functions | |||
COUNTIF FORMULA ISSUES - NEED FORMULA CORRECTED | Excel Worksheet Functions | |||
countif formula | Excel Discussion (Misc queries) | |||
CountIf formula results in the formula itself being displayed. | Excel Worksheet Functions | |||
Doing a 'countif' but I just want the value not the formula | Excel Programming |