Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Carole
 
Posts: n/a
Default Sum cell numbers that have certain text within the cell

I want to have a formula that I can put into cell P4, Q4, and R4 that will
sum the range "A4:D4" that contain the text "CE", "LS", and "LA". I have
tried variations of sum, sumif, and sumproduct, that also included
substitute, none seem to give me the answer. They either give me an error or
"0".
A4 = 1 CE
B4 = 1.5 LS
C4 = 1 LA
D4 = 2.25 CE
Please help!

  #2   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

For CE in P4...

=SUMPRODUCT(--(TRIM(REPLACE($A$4:$D$4,1,SEARCH(" ",$A$4:$D$4&"
"),""))="CE"),--LEFT(A4:D4,SEARCH(" ",$A$4:$D$4&" ")))

Carole wrote:
I want to have a formula that I can put into cell P4, Q4, and R4 that will
sum the range "A4:D4" that contain the text "CE", "LS", and "LA". I have
tried variations of sum, sumif, and sumproduct, that also included
substitute, none seem to give me the answer. They either give me an error or
"0".
A4 = 1 CE
B4 = 1.5 LS
C4 = 1 LA
D4 = 2.25 CE
Please help!

  #3   Report Post  
Per Erik Midtrød
 
Posts: n/a
Default

Will your letters alway at the end og the cells?

Per Erik
On Wed, 26 Jan 2005 13:41:03 -0800, Carole
wrote:

I want to have a formula that I can put into cell P4, Q4, and R4 that will
sum the range "A4:D4" that contain the text "CE", "LS", and "LA". I have
tried variations of sum, sumif, and sumproduct, that also included
substitute, none seem to give me the answer. They either give me an error or
"0".
A4 = 1 CE
B4 = 1.5 LS
C4 = 1 LA
D4 = 2.25 CE
Please help!


  #4   Report Post  
Myrna Larson
 
Posts: n/a
Default

Do you mean that you are trying to store 2 pieces of information, the number 1
and the text CE, in the same cell?

As evidenced by Alladin's formula, you will make your life much easier if you
put the 1 in A4 and the CE in A5.

Then you could use =SUMIF(A5:D5,"CE",A4:D4)

On Wed, 26 Jan 2005 13:41:03 -0800, Carole
wrote:

I want to have a formula that I can put into cell P4, Q4, and R4 that will
sum the range "A4:D4" that contain the text "CE", "LS", and "LA". I have
tried variations of sum, sumif, and sumproduct, that also included
substitute, none seem to give me the answer. They either give me an error or
"0".
A4 = 1 CE
B4 = 1.5 LS
C4 = 1 LA
D4 = 2.25 CE
Please help!


  #5   Report Post  
Carole
 
Posts: n/a
Default

This didn't work. It gave me "#value!" for a result. I do need to keep the
quantity and text in the same cells that I want to add. Also, sometimes
there are multiple quantities and text in the same cell but on seperate lines
(1 CE "hard return" 1 LS). I need it to find and add those instances also.

"Aladin Akyurek" wrote:

For CE in P4...

=SUMPRODUCT(--(TRIM(REPLACE($A$4:$D$4,1,SEARCH(" ",$A$4:$D$4&"
"),""))="CE"),--LEFT(A4:D4,SEARCH(" ",$A$4:$D$4&" ")))

Carole wrote:
I want to have a formula that I can put into cell P4, Q4, and R4 that will
sum the range "A4:D4" that contain the text "CE", "LS", and "LA". I have
tried variations of sum, sumif, and sumproduct, that also included
substitute, none seem to give me the answer. They either give me an error or
"0".
A4 = 1 CE
B4 = 1.5 LS
C4 = 1 LA
D4 = 2.25 CE
Please help!




  #6   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

Carole wrote:
This didn't work.


Well, it should work for data you initially forwarded, consisting of a
single pair of a Number followed by a Symbol.

It gave me "#value!" for a result.


Yes, it should do that with multiple pairs per cell.

I do need to keep the
quantity and text in the same cells that I want to add. Also, sometimes
there are multiple quantities and text in the same cell but on seperate lines
(1 CE "hard return" 1 LS). I need it to find and add those instances also.


I think Myrna's observation about your data representation is now more
urgent.


"Aladin Akyurek" wrote:


For CE in P4...

=SUMPRODUCT(--(TRIM(REPLACE($A$4:$D$4,1,SEARCH(" ",$A$4:$D$4&"
"),""))="CE"),--LEFT(A4:D4,SEARCH(" ",$A$4:$D$4&" ")))

Carole wrote:

I want to have a formula that I can put into cell P4, Q4, and R4 that will
sum the range "A4:D4" that contain the text "CE", "LS", and "LA". I have
tried variations of sum, sumif, and sumproduct, that also included
substitute, none seem to give me the answer. They either give me an error or
"0".
A4 = 1 CE
B4 = 1.5 LS
C4 = 1 LA
D4 = 2.25 CE
Please help!


  #7   Report Post  
Carole
 
Posts: n/a
Default

I tried limiting the formula to look at the array that either doesn't have
any input, or has only one number/text entry. It still gave me the "#value!"
error. I am not able to seperate the number from the text because I have
conditional formating on those entry cells so they highlight when a specific
text is input in that cell.

"Aladin Akyurek" wrote:

Carole wrote:
This didn't work.


Well, it should work for data you initially forwarded, consisting of a
single pair of a Number followed by a Symbol.

It gave me "#value!" for a result.


Yes, it should do that with multiple pairs per cell.

I do need to keep the
quantity and text in the same cells that I want to add. Also, sometimes
there are multiple quantities and text in the same cell but on seperate lines
(1 CE "hard return" 1 LS). I need it to find and add those instances also.


I think Myrna's observation about your data representation is now more
urgent.


"Aladin Akyurek" wrote:


For CE in P4...

=SUMPRODUCT(--(TRIM(REPLACE($A$4:$D$4,1,SEARCH(" ",$A$4:$D$4&"
"),""))="CE"),--LEFT(A4:D4,SEARCH(" ",$A$4:$D$4&" ")))

Carole wrote:

I want to have a formula that I can put into cell P4, Q4, and R4 that will
sum the range "A4:D4" that contain the text "CE", "LS", and "LA". I have
tried variations of sum, sumif, and sumproduct, that also included
substitute, none seem to give me the answer. They either give me an error or
"0".
A4 = 1 CE
B4 = 1.5 LS
C4 = 1 LA
D4 = 2.25 CE
Please help!



  #8   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

Carole wrote:
I tried limiting the formula to look at the array that either doesn't have
any input, or has only one number/text entry. It still gave me the "#value!"
error. I am not able to seperate the number from the text because I have
conditional formating on those entry cells so they highlight when a specific
text is input in that cell.

[...]

The formula does indeed error out on empty cells. But it can be
corrected for that...

=SUMPRODUCT(--(TRIM(REPLACE($A$4:$D$4,1,SEARCH(" ",$A$4:$D$4&"
"),""))="CE"),--LEFT(0&$A$4:$D$4,SEARCH(" ",$A$4:$D$4&" ")))

Recall that it's meant just for pairs consisting of a number and a
symbol, separated by a space.
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
Cell set to wrap text and blank line -- fix? Fred Holmes Excel Discussion (Misc queries) 0 January 25th 05 07:10 PM
How can I write in a text in a cell using numbers and the letters. Sandy Excel Discussion (Misc queries) 2 January 10th 05 11:49 PM
how to hyperlink text to a cell steve New Users to Excel 1 December 14th 04 08:21 PM
Paste rows of numbers from Word into single Excel cell BecG Excel Discussion (Misc queries) 1 December 8th 04 04:55 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


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