Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Some cells contain # and text, some # only - want to sum # (number

Say cell A1 contains 1*, and A2 contains 1, when I do sum(A1:A2) I get 1 as
the answer (obviously).

I would like to be able to include the numerical part of the entries in
these cells and ignore the text part. I know that I can format cell A1 like
this: # "*", but to apply a special format to each cell that includes the *
is a clumsy approach I think.

Is there any way to format all the cells so that the *'s are ignored,
without writing a macro?

Thanks for your time.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Some cells contain # and text, some # only - want to sum # (number

Assuming that every cell that contains "*" also contains a number...

Try this array formula** :

=SUM(IF(RIGHT(A1:A10)="*",--LEFT(A1:A10,LEN(A1:A10)-1)),A1:A10)

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"NCCADM" wrote in message
...
Say cell A1 contains 1*, and A2 contains 1, when I do sum(A1:A2) I get 1
as
the answer (obviously).

I would like to be able to include the numerical part of the entries in
these cells and ignore the text part. I know that I can format cell A1
like
this: # "*", but to apply a special format to each cell that includes the
*
is a clumsy approach I think.

Is there any way to format all the cells so that the *'s are ignored,
without writing a macro?

Thanks for your time.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Some cells contain # and text, some # only - want to sum # (number


Perhaps:

=SUM(IF(ISNUMBER(A1:A2),A1:A2,LEFT(A1:A2,FIND("*", A1:A2)-1)+0))

confirmed with CTRL+SHIFT+ENTER not just ENTER


--
NBVC

Where there is a will there are many ways.

'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
NBVC's Profile: http://www.thecodecage.com/forumz/member.php?userid=74
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=123976

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Some cells contain # and text, some # only - want to sum # (number

To sum all cells; try the below formula

Please note that this is an array formula. Within the cell in edit mode (F2)
paste this formula and press Ctrl+Shift+Enter to apply this formula. If
successful in 'Formula Bar' you can notice the curly braces at both ends like
"{=<formula}"

=SUM(IF(A1:A20<"",SUBSTITUTE(A1:A20,"*","")+0))

If this post helps click Yes
---------------
Jacob Skaria


"NCCADM" wrote:

Say cell A1 contains 1*, and A2 contains 1, when I do sum(A1:A2) I get 1 as
the answer (obviously).

I would like to be able to include the numerical part of the entries in
these cells and ignore the text part. I know that I can format cell A1 like
this: # "*", but to apply a special format to each cell that includes the *
is a clumsy approach I think.

Is there any way to format all the cells so that the *'s are ignored,
without writing a macro?

Thanks for your time.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Some cells contain # and text, some # only - want to sum # (number

On Mon, 10 Aug 2009 09:43:02 -0700, NCCADM
wrote:

Say cell A1 contains 1*, and A2 contains 1, when I do sum(A1:A2) I get 1 as
the answer (obviously).

I would like to be able to include the numerical part of the entries in
these cells and ignore the text part. I know that I can format cell A1 like
this: # "*", but to apply a special format to each cell that includes the *
is a clumsy approach I think.

Is there any way to format all the cells so that the *'s are ignored,
without writing a macro?

Thanks for your time.



=SUMPRODUCT(--SUBSTITUTE("0"&A1:A10,"*",""))

--ron


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Some cells contain # and text, some # only - want to sum # (nu

Thanks for the solutions guys

I'm now off to study arrays

"Ron Rosenfeld" wrote:

On Mon, 10 Aug 2009 09:43:02 -0700, NCCADM
wrote:

Say cell A1 contains 1*, and A2 contains 1, when I do sum(A1:A2) I get 1 as
the answer (obviously).

I would like to be able to include the numerical part of the entries in
these cells and ignore the text part. I know that I can format cell A1 like
this: # "*", but to apply a special format to each cell that includes the *
is a clumsy approach I think.

Is there any way to format all the cells so that the *'s are ignored,
without writing a macro?

Thanks for your time.



=SUMPRODUCT(--SUBSTITUTE("0"&A1:A10,"*",""))

--ron

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
Excel Changes Text Cells to Number Cells When Importing XML Villerat Excel Discussion (Misc queries) 0 July 24th 08 01:59 AM
sumif where cells contain Number & Text Fred Excel Discussion (Misc queries) 10 January 23rd 07 09:22 PM
number of cells containing text Xhawk57 Excel Discussion (Misc queries) 1 August 11th 06 05:44 PM
How to set a number number value as text in all cells ? Paul Peters Excel Worksheet Functions 0 August 11th 06 07:27 AM
total cells with text and number EX: GS-5 dap1 Excel Worksheet Functions 4 May 4th 06 02:21 PM


All times are GMT +1. The time now is 02:48 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"