#1   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default countif

I would like to incorporate the formula COUNTIF(A1:A472,"Zanesville") in my
macro

Zanesville would be filled in from the last row of data in the row the
formula appears

I thought something like (which doesn't work):

..Cells(i, "E").Formula = "=countif(A1:A" & LastRow & """" & _
.Cells(i - 1, "A").Value & """))"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default countif

Not sure about how where you say "Zanesville" will be found works out with
your .Cells(i-1,"A").Value reference, but assuming your attempted formula is
using the correct referenced parts, see if this works for you...

..Cells(i, "E").Formula = "=COUNTIF(A1:A" & LastRow & ",""" & _
.Cells(i - 1, "A").Value & """)"

--
Rick (MVP - Excel)


"Bob" wrote in message
...
I would like to incorporate the formula COUNTIF(A1:A472,"Zanesville") in my
macro

Zanesville would be filled in from the last row of data in the row the
formula appears

I thought something like (which doesn't work):

.Cells(i, "E").Formula = "=countif(A1:A" & LastRow & """" & _
.Cells(i - 1, "A").Value & """))"


  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default countif

works great! Thank you.

anyway I could put the word "Total" in the cell left of the formula (formula
is in column E and the word "Total would be in colmn D)?

"Rick Rothstein" wrote:

Not sure about how where you say "Zanesville" will be found works out with
your .Cells(i-1,"A").Value reference, but assuming your attempted formula is
using the correct referenced parts, see if this works for you...

..Cells(i, "E").Formula = "=COUNTIF(A1:A" & LastRow & ",""" & _
.Cells(i - 1, "A").Value & """)"

--
Rick (MVP - Excel)


"Bob" wrote in message
...
I would like to incorporate the formula COUNTIF(A1:A472,"Zanesville") in my
macro

Zanesville would be filled in from the last row of data in the row the
formula appears

I thought something like (which doesn't work):

.Cells(i, "E").Formula = "=countif(A1:A" & LastRow & """" & _
.Cells(i - 1, "A").Value & """))"



  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default countif

Answered my own question with:
Cells(i, "D").Formula = "Total"

"Bob" wrote:

I would like to incorporate the formula COUNTIF(A1:A472,"Zanesville") in my
macro

Zanesville would be filled in from the last row of data in the row the
formula appears

I thought something like (which doesn't work):

.Cells(i, "E").Formula = "=countif(A1:A" & LastRow & """" & _
.Cells(i - 1, "A").Value & """))"

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default countif

anyway I could put the word "Total" in the cell left of the formula
(formula is in column E and the word "Total would be in colmn D)?


I do not understand the question you are asking here. Can you rephrase it
and maybe show us an example?

--
Rick (MVP - Excel)

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
Countif earlfj Excel Worksheet Functions 2 September 23rd 09 03:05 AM
How do I use a countif function according to two other countif fu. Kirsty Excel Worksheet Functions 2 February 20th 06 11:44 AM
edit this =COUNTIF(A1:F16,"*1-2*")+COUNTIF(A1:F16,"*2-1*") sctroy Excel Discussion (Misc queries) 2 September 25th 05 04:13 AM
COUNTIF or not to COUNTIF on a range in another sheet Ellie Excel Worksheet Functions 4 September 15th 05 10:06 PM
COUNTIF in one colum then COUNTIF in another...??? JonnieP Excel Worksheet Functions 3 February 22nd 05 02:55 PM


All times are GMT +1. The time now is 05:15 AM.

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"