Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All.......
How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
=COUNTIF(A:A,"*JOHN*") In article , CLR wrote: Hi All....... How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
something like
mc=0 for each c in selection if instr(c,"John")0 then mc=mc+1 next c msgbox mc -- Don Guillett SalesAid Software "CLR" wrote in message ... Hi All....... How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Cool, thanks JE..........just tweaked it a bit for my application...
Sub FindName() Range("B1").Formula = "=COUNTIF(n:n,""*john*"")" End Sub Many thanks.......... Vaya con Dios, Chuck, CABGx3 "JE McGimpsey" wrote: One way: =COUNTIF(A:A,"*JOHN*") In article , CLR wrote: Hi All....... How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub countjohn()
For Each c In Selection If InStr(UCase(c), "JOHN") 0 Then mc = mc + 1 Next c MsgBox mc End Sub -- Don Guillett SalesAid Software "CLR" wrote in message ... Thanks Don..........works good but seems to be "case sensitive".......can anything be done to change that? Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: something like mc=0 for each c in selection if instr(c,"John")0 then mc=mc+1 next c msgbox mc -- Don Guillett SalesAid Software "CLR" wrote in message ... Hi All....... How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Or if you no longer need the formula
'Range("B1").Formula = "=COUNTIF(n:n,""*john*"")" Range("b1").Value = Application.CountIf(Columns("n"), "*john*") -- Don Guillett SalesAid Software "CLR" wrote in message ... Cool, thanks JE..........just tweaked it a bit for my application... Sub FindName() Range("B1").Formula = "=COUNTIF(n:n,""*john*"")" End Sub Many thanks.......... Vaya con Dios, Chuck, CABGx3 "JE McGimpsey" wrote: One way: =COUNTIF(A:A,"*JOHN*") In article , CLR wrote: Hi All....... How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Don, this new one requires the entire string to be UpperCase. Can it
be modified to be not case sensitive to any of the characters in the string? Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: Sub countjohn() For Each c In Selection If InStr(UCase(c), "JOHN") 0 Then mc = mc + 1 Next c MsgBox mc End Sub -- Don Guillett SalesAid Software "CLR" wrote in message ... Thanks Don..........works good but seems to be "case sensitive".......can anything be done to change that? Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: something like mc=0 for each c in selection if instr(c,"John")0 then mc=mc+1 next c msgbox mc -- Don Guillett SalesAid Software "CLR" wrote in message ... Hi All....... How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How slick it is...........thanks Don!
Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: Or if you no longer need the formula 'Range("B1").Formula = "=COUNTIF(n:n,""*john*"")" Range("b1").Value = Application.CountIf(Columns("n"), "*john*") -- Don Guillett SalesAid Software "CLR" wrote in message ... Cool, thanks JE..........just tweaked it a bit for my application... Sub FindName() Range("B1").Formula = "=COUNTIF(n:n,""*john*"")" End Sub Many thanks.......... Vaya con Dios, Chuck, CABGx3 "JE McGimpsey" wrote: One way: =COUNTIF(A:A,"*JOHN*") In article , CLR wrote: Hi All....... How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
???
-- Don Guillett SalesAid Software "CLR" wrote in message ... Thanks Don, this new one requires the entire string to be UpperCase. Can it be modified to be not case sensitive to any of the characters in the string? Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: Sub countjohn() For Each c In Selection If InStr(UCase(c), "JOHN") 0 Then mc = mc + 1 Next c MsgBox mc End Sub -- Don Guillett SalesAid Software "CLR" wrote in message ... Thanks Don..........works good but seems to be "case sensitive".......can anything be done to change that? Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: something like mc=0 for each c in selection if instr(c,"John")0 then mc=mc+1 next c msgbox mc -- Don Guillett SalesAid Software "CLR" wrote in message ... Hi All....... How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry, didn't see your other suggestion when I did this post..........your
other one will do me just fine......... Many thanks again, Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: ??? -- Don Guillett SalesAid Software "CLR" wrote in message ... Thanks Don, this new one requires the entire string to be UpperCase. Can it be modified to be not case sensitive to any of the characters in the string? Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: Sub countjohn() For Each c In Selection If InStr(UCase(c), "JOHN") 0 Then mc = mc + 1 Next c MsgBox mc End Sub -- Don Guillett SalesAid Software "CLR" wrote in message ... Thanks Don..........works good but seems to be "case sensitive".......can anything be done to change that? Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: something like mc=0 for each c in selection if instr(c,"John")0 then mc=mc+1 next c msgbox mc -- Don Guillett SalesAid Software "CLR" wrote in message ... Hi All....... How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Glad to help
-- Don Guillett SalesAid Software "CLR" wrote in message ... Sorry, didn't see your other suggestion when I did this post..........your other one will do me just fine......... Many thanks again, Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: ??? -- Don Guillett SalesAid Software "CLR" wrote in message ... Thanks Don, this new one requires the entire string to be UpperCase. Can it be modified to be not case sensitive to any of the characters in the string? Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: Sub countjohn() For Each c In Selection If InStr(UCase(c), "JOHN") 0 Then mc = mc + 1 Next c MsgBox mc End Sub -- Don Guillett SalesAid Software "CLR" wrote in message ... Thanks Don..........works good but seems to be "case sensitive".......can anything be done to change that? Vaya con Dios, Chuck, CABGx3 "Don Guillett" wrote: something like mc=0 for each c in selection if instr(c,"John")0 then mc=mc+1 next c msgbox mc -- Don Guillett SalesAid Software "CLR" wrote in message ... Hi All....... How might the code read to perform a check of all cells in the selected column and count all the cells which contain a certain string at least once, and place the total in cell B1. That is, if the string exists by itself, or within a string of other characters in the same cell.....and if multiple times in one cell, only count once. If looking for JOHN, Cell with JOHN ...would count 1 Cell with JOHN/BILL /TOM & OTHERS... would count 1 Cell with JOHN / BILL,JOHN ...would count 1 Cell with BILL, TOM ...would not count (note the inconsistant punctuation) TIA for any help Vaya con Dios, Chuck, CABGx3 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
=SUBSTITUTE(C4,"~?#","") will this work to remove multiple string | Excel Worksheet Functions | |||
Difficulty "countif"-ing number of "L1" or "L2" on an autofiltered | Excel Worksheet Functions | |||
Converting "uppercase" string data to "lower case" in CSV file | Excel Discussion (Misc queries) | |||
text string: "91E10" in csv file auto converts to: "9.10E+11" | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) |