PC Review


Reply
Thread Tools Rate Thread

Amending an existing formual to improve grammar

 
 
Colin Hayes
Guest
Posts: n/a
 
      29th May 2011

Hi All

I use the following formula to count entries into C6:C17 , and say how
many months have been taken up :

="Totals ("&COUNTA(C6:C17)&" Months)"

The syntax is clearly wrong when the there is only one entry , reading
"Totals (1 Months)".

Can anyone suggest an amendment so that this will read "Totals (1
Month)" and accommodate the single entry?

Grateful for any help.
 
Reply With Quote
 
 
 
 
joeu2004
Guest
Posts: n/a
 
      30th May 2011
On May 29, 3:40*pm, Colin Hayes <Co...@chayes.demon.co.uk> wrote:
> ="Totals ("&COUNTA(C6:C17)&" Months)"

[....]
> Can anyone suggest an amendment so that this will read
> "Totals (1 Month)" and accommodate the single entry?


="Totals (" & COUNTA(C6:C17)
& IF(COUNTA(C6:C17)=1," Month)"," Months)")

Note that that might display "Totals (0 Months)". That is
syntactically correct. But I wonder if you would prefer something
else entirely in that case.
 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      30th May 2011
Another way...
="Totals ("&COUNTA(C6:C17)&MID(" Months",1,7-(COUNTA(C6:C17)=1))&")"

--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(free and commercial excel programs)





"Colin Hayes" <(E-Mail Removed)>
wrote in message
news:(E-Mail Removed)...
>
> Hi All
>
> I use the following formula to count entries into C6:C17 , and say how many months have been taken
> up :
>
> ="Totals ("&COUNTA(C6:C17)&" Months)"
>
> The syntax is clearly wrong when the there is only one entry , reading "Totals (1 Months)".
>
> Can anyone suggest an amendment so that this will read "Totals (1 Month)" and accommodate the
> single entry?
>
> Grateful for any help.



 
Reply With Quote
 
Colin Hayes
Guest
Posts: n/a
 
      30th May 2011
In article
<a11b52bc-9e0c-4c0e-914c-(E-Mail Removed)>,
joeu2004 <(E-Mail Removed)> writes
>On May 29, 3:40*pm, Colin Hayes <Co...@chayes.demon.co.uk> wrote:
>> ="Totals ("&COUNTA(C6:C17)&" Months)"

>[....]
>> Can anyone suggest an amendment so that this will read
>> "Totals (1 Month)" and accommodate the single entry?

>
>="Totals (" & COUNTA(C6:C17)
>& IF(COUNTA(C6:C17)=1," Month)"," Months)")
>
>Note that that might display "Totals (0 Months)". That is
>syntactically correct. But I wonder if you would prefer something
>else entirely in that case.



HI

OK thanks for getting back. This works perfectly first time , and solves
the issue.

I agree that "Totals (0 Months)" is correct but looks odd. I suppose an
improvement would be if it just said "Totals" , or better still if it
were blank where entries are yet to be made in the cells C6:C17. I think
some conditional formatting could fix this.

Anyway thanks again for your time and expertise.

Best Wishes

 
Reply With Quote
 
joeu2004
Guest
Posts: n/a
 
      30th May 2011
On May 29, 4:41*pm, Colin Hayes <Co...@chayes.demon.co.uk> wrote:
> >="Totals (" & COUNTA(C6:C17)
> >& IF(COUNTA(C6:C17)=1," Month)"," Months)")

[....]
> I agree that "Totals (0 Months)" is correct but looks odd.
> I suppose an improvement would be if it just said "Totals",
> or better still if it were blank where entries are yet to
> be made in the cells C6:C17.


=IF(COUNTA(C6:C17)=0, "",
"Totals (" & COUNTA(C6:C17)
& IF(COUNTA(C6:C17)=1," Month)"," Months)"))

Caveat: If any of C6:C17 displays the null string (""), as this
formula does sometimes, COUNTA(C6:C17) will not be zero. If you would
like null strings not to be counted (because the cell looks blank),
try:

=IF(SUMPRODUCT(--(C6:C17<>""))=0, "",
"Totals (" & SUMPRODUCT(--(C6:C17<>""))
& IF(COUNTA(C6:C17)=1," Month)"," Months)"))

The double-negative (--) converts TRUE and FALSE to 1 and 0, which
SUMPRODUCT requires.
 
Reply With Quote
 
Colin Hayes
Guest
Posts: n/a
 
      30th May 2011
In article
<3ca5afc3-7a7c-4e6d-8860-(E-Mail Removed)>,
joeu2004 <(E-Mail Removed)> writes
>On May 29, 4:41*pm, Colin Hayes <Co...@chayes.demon.co.uk> wrote:
>> >="Totals (" & COUNTA(C6:C17)
>> >& IF(COUNTA(C6:C17)=1," Month)"," Months)")

>[....]
>> I agree that "Totals (0 Months)" is correct but looks odd.
>> I suppose an improvement would be if it just said "Totals",
>> or better still if it were blank where entries are yet to
>> be made in the cells C6:C17.

>
>=IF(COUNTA(C6:C17)=0, "",
>"Totals (" & COUNTA(C6:C17)
>& IF(COUNTA(C6:C17)=1," Month)"," Months)"))
>
>Caveat: If any of C6:C17 displays the null string (""), as this
>formula does sometimes, COUNTA(C6:C17) will not be zero. If you would
>like null strings not to be counted (because the cell looks blank),
>try:
>
>=IF(SUMPRODUCT(--(C6:C17<>""))=0, "",
>"Totals (" & SUMPRODUCT(--(C6:C17<>""))
>& IF(COUNTA(C6:C17)=1," Month)"," Months)"))
>
>The double-negative (--) converts TRUE and FALSE to 1 and 0, which
>SUMPRODUCT requires.



Hi

OK that's solved it perfectly.

Thanks again for that - very impressive.

Thanks too for the SUMPRODUCT tip.

Best Wishes

 
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 do I improve the grammar checker? afisk413 Microsoft Word Document Management 5 12th Nov 2008 07:23 AM
Improve grammar correction =?Utf-8?B?d2ltIHRvbg==?= Microsoft Word Document Management 0 25th Oct 2006 03:07 PM
Amending an existing function =?Utf-8?B?UGF5ZG9nNA==?= Microsoft Excel Worksheet Functions 2 28th Feb 2006 03:52 AM
Idea to improve Grammar checking =?Utf-8?B?Um9iZXJ0IE1jTg==?= Microsoft Word Document Management 0 16th Nov 2005 10:46 PM
Improve the grammar tool or drop it. It is often wrong. =?Utf-8?B?ZGdyb3Zlcw==?= Microsoft Word Document Management 1 20th Feb 2005 09:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:21 AM.