PC Review


Reply
Thread Tools Rate Thread

Display CountA Formula and Text String in a cell

 
 
henryonyeagbako@hotmail.com
Guest
Posts: n/a
 
      15th Mar 2008
I have the following line of code that inserts into a particular cell
the count of the No. of asset records listed above it plus a text
string declaring " Assets in the selected period" plus it takes the
date value of two variables and formats them and places them in cell
along the text



rng.Formula = "=COUNTA(R[-4]C:R[-1]C)" & "&"" assets Aquired in the
selected period " & "" & Format$(first, "short date") & "" - "" &
Format$(last, "short date")




My problem is that this does not display as i would have liked the
dates are merely displayed as decimal numbers. I have changed the
format of the cell to correct this but that does not appear to alter
anything.

How do i get the cell to display the count for the cells display the
text message and the criteria range in the same cell
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      16th Mar 2008
I'd use rng.formulaR1C1:

rng.FormulaR1C1 = "=COUNTA(R[-4]C:R[-1]C)" _
& " & " & """ assets Aquired in the selected period ""&" _
& """" & Format$(first, "short date") _
& " - " & Format$(last, "short date") & """"

(E-Mail Removed) wrote:
>
> I have the following line of code that inserts into a particular cell
> the count of the No. of asset records listed above it plus a text
> string declaring " Assets in the selected period" plus it takes the
> date value of two variables and formats them and places them in cell
> along the text
>
> rng.Formula = "=COUNTA(R[-4]C:R[-1]C)" & "&"" assets Aquired in the
> selected period " & "" & Format$(first, "short date") & "" - "" &
> Format$(last, "short date")
>
> My problem is that this does not display as i would have liked the
> dates are merely displayed as decimal numbers. I have changed the
> format of the cell to correct this but that does not appear to alter
> anything.
>
> How do i get the cell to display the count for the cells display the
> text message and the criteria range in the same cell


--

Dave Peterson
 
Reply With Quote
 
henryonyeagbako@hotmail.com
Guest
Posts: n/a
 
      16th Mar 2008
On Mar 16, 12:37*am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> I'd use rng.formulaR1C1:
>
> rng.FormulaR1C1 = "=COUNTA(R[-4]C:R[-1]C)" _
> * * * * * * * * * * & " & " & """ assets Aquired in the selected period ""&" _
> * * * * * * * * * * & """" & Format$(first, "short date") _
> * * * * * * * * * * & " - " & Format$(last, "short date") & """"
>
>
>
>
>
> henryonyeagb...@hotmail.com wrote:
>
> > I have the following line of code that inserts into a particular cell
> > the count of the No. of asset records listed above it plus a text
> > string declaring " Assets in the selected period" plus it takes the
> > date value of two variables and formats them and places them in cell
> > along the text

>
> > rng.Formula = "=COUNTA(R[-4]C:R[-1]C)" & "&"" assets Aquired in the
> > selected period " & "" & Format$(first, "short date") & "" - "" &
> > Format$(last, "short date")

>
> > My problem is that this does not display as i would have liked the
> > dates are merely displayed as decimal numbers. I have changed the
> > format of the cell to correct this but that does not appear to alter
> > anything.

>
> > How do i get the cell to display the count for the cells display the
> > text message and the *criteria range in the same cell

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -


Thanks for that it worked like a charm but now how do i get the
followiing to work also:-

rng.FormulaR1C1 = "=COUNTA(" & ActiveCell.Offset(-1, 0).Address & ":$A
$9)" & " & " & """ assets Aquired in the selected period ""&" & """" &
Format$(first, "short date") & " - " & Format$(last, "short date") &
""""
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      16th Mar 2008
First, .address by itself won't give you an R1C1 reference style address. So in
this case, you don't want to use .formular1c1 (and $A$9 isn't an R1C1 address,
either).

So just try

Rng.Formula = "=COUNTA(" & ActiveCell.Offset(-1, 0).Address _
& ":$A$9)" & " & " _
& """ assets Aquired in the selected period ""&" _
& """" & Format$(First, "short date") _
& " - " & Format$(Last, "short date") & """"



(E-Mail Removed) wrote:
>

<<snipped>>
>
> rng.FormulaR1C1 = "=COUNTA(" & ActiveCell.Offset(-1, 0).Address & ":$A
> $9)" & " & " & """ assets Aquired in the selected period ""&" & """" &
> Format$(first, "short date") & " - " & Format$(last, "short date") &
> """"


--

Dave Peterson
 
Reply With Quote
 
henryonyeagbako@hotmail.com
Guest
Posts: n/a
 
      17th Mar 2008
On Mar 16, 12:37*am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> I'd use rng.formulaR1C1:
>
> rng.FormulaR1C1 = "=COUNTA(R[-4]C:R[-1]C)" _
> * * * * * * * * * * & " & " & """ assets Aquired in the selected period ""&" _
> * * * * * * * * * * & """" & Format$(first, "short date") _
> * * * * * * * * * * & " - " & Format$(last, "short date") & """"
>
>
>
>
>
> henryonyeagb...@hotmail.com wrote:
>
> > I have the following line of code that inserts into a particular cell
> > the count of the No. of asset records listed above it plus a text
> > string declaring " Assets in the selected period" plus it takes the
> > date value of two variables and formats them and places them in cell
> > along the text

>
> > rng.Formula = "=COUNTA(R[-4]C:R[-1]C)" & "&"" assets Aquired in the
> > selected period " & "" & Format$(first, "short date") & "" - "" &
> > Format$(last, "short date")

>
> > My problem is that this does not display as i would have liked the
> > dates are merely displayed as decimal numbers. I have changed the
> > format of the cell to correct this but that does not appear to alter
> > anything.

>
> > How do i get the cell to display the count for the cells display the
> > text message and the *criteria range in the same cell

>
> --
>
> Dave Peterson- Hide quoted text -
>
> - Show quoted text -


Thank you very much three hours spent on this was driving me stir
crazy


Henry Onyeagbako
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get string to use IF formula only when another cell is text GoinCrazy Microsoft Excel Worksheet Functions 2 27th Mar 2009 10:18 PM
Formula to return a value for a portion of a text string in a cell NanGio Microsoft Excel Misc 2 29th Jan 2009 10:36 PM
Display contents of cell in another cell as part of text string? mschmidt@carolina.rr.com Microsoft Excel New Users 3 8th Jul 2006 07:44 PM
COUNTA for a cell with a formula Steve Jackson Microsoft Excel Worksheet Functions 5 19th Apr 2006 08:09 PM
Return a formula as text string to a cell =?Utf-8?B?U2hhcm9u?= Microsoft Excel Worksheet Functions 4 18th Apr 2006 05:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:24 PM.