Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 28
Default Adding columns containing numbers with dashes

I have several columns (formatted as text) containing numbers with
dashes, i.e.,

20-1
15-2
30-4
05-3

Is there a way to add up the numbers separately in the column, i.e,
one total for the 20, 15, 20, 05 and one total for the 1, 2, 4, 3. If unable
to add both is it possible to add up just the numbers to the left of the
dash? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 860
Default Adding columns containing numbers with dashes

Hi Randi,

Assuming your data is in A1:A4
In B1 put =SUM(LEFT(A1:A4,2)*1)
and in C1 put =SUM(RIGHT(A1:A4,1)*1)
Both formulae are array formulas so must be committed with
Ctrl+Shift+Enter and not just enter

HTH
Martin


"Randi" wrote in message
...
I have several columns (formatted as text) containing numbers with
dashes, i.e.,

20-1
15-2
30-4
05-3

Is there a way to add up the numbers separately in the column, i.e,
one total for the 20, 15, 20, 05 and one total for the 1, 2, 4, 3. If
unable
to add both is it possible to add up just the numbers to the left of the
dash? Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 964
Default Adding columns containing numbers with dashes

These formulas should work:

For numbers to the left of the -:
=SUMPRODUCT(--(LEFT(A1:A10,FIND("-",A1:A10)-1)))

For numbers to the right of the -:
=SUMPRODUCT(--(MID(A1:A10,FIND("-",A1:A10)+1,99)))

Adjust the range A1:A10 to meet your needs.

HTH,
Elkar


"Randi" wrote:

I have several columns (formatted as text) containing numbers with
dashes, i.e.,

20-1
15-2
30-4
05-3

Is there a way to add up the numbers separately in the column, i.e,
one total for the 20, 15, 20, 05 and one total for the 1, 2, 4, 3. If unable
to add both is it possible to add up just the numbers to the left of the
dash? Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 28
Default Adding columns containing numbers with dashes

Thank you - that works - but now I need something different. How can I
change that formula to multiple the number to the left of the dash by the
number to the right of the dash, i.e., 40-2 = 80 and thenadd up the totals?
thanks


"MartinW" wrote:

Hi Randi,

Assuming your data is in A1:A4
In B1 put =SUM(LEFT(A1:A4,2)*1)
and in C1 put =SUM(RIGHT(A1:A4,1)*1)
Both formulae are array formulas so must be committed with
Ctrl+Shift+Enter and not just enter

HTH
Martin


"Randi" wrote in message
...
I have several columns (formatted as text) containing numbers with
dashes, i.e.,

20-1
15-2
30-4
05-3

Is there a way to add up the numbers separately in the column, i.e,
one total for the 20, 15, 20, 05 and one total for the 1, 2, 4, 3. If
unable
to add both is it possible to add up just the numbers to the left of the
dash? Thanks.




  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,268
Default Adding columns containing numbers with dashes

Do you import these values, if not why are you using what is a really bad
layout?

The best way would be to make sure the column to the right is empty, then
select
the column with these values and do data text to columns, select delimited
and click next, then as delimiter select - and then click finish, then
simply use

=SUMPRODUCT(A1:A5,B1:B5)


Using Elkar's formula

=SUMPRODUCT(--(LEFT(A1:A10,FIND("-",A1:A10)-1)),--(MID(A1:A10,FIND("-",A1:A10)+1,99)))


however if there is a value without a dash or an empty cell it will return
an error



--
Regards,

Peo Sjoblom

"Randi" wrote in message
...
Thank you - that works - but now I need something different. How can I
change that formula to multiple the number to the left of the dash by the
number to the right of the dash, i.e., 40-2 = 80 and thenadd up the
totals?
thanks


"MartinW" wrote:

Hi Randi,

Assuming your data is in A1:A4
In B1 put =SUM(LEFT(A1:A4,2)*1)
and in C1 put =SUM(RIGHT(A1:A4,1)*1)
Both formulae are array formulas so must be committed with
Ctrl+Shift+Enter and not just enter

HTH
Martin


"Randi" wrote in message
...
I have several columns (formatted as text) containing numbers with
dashes, i.e.,

20-1
15-2
30-4
05-3

Is there a way to add up the numbers separately in the column, i.e,
one total for the 20, 15, 20, 05 and one total for the 1, 2, 4, 3. If
unable
to add both is it possible to add up just the numbers to the left of
the
dash? Thanks.








  #6   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 860
Default Adding columns containing numbers with dashes

Hi Randi,

This will work for your simplified example
=SUMPRODUCT(--(LEFT(A1:A4,2)*(--(RIGHT(A1:A4,1)))))

However I think it may be better to look at separating your data
with text to columns and then working from there.

HTH
Martin


"Randi" wrote in message
...
Thank you - that works - but now I need something different. How can I
change that formula to multiple the number to the left of the dash by the
number to the right of the dash, i.e., 40-2 = 80 and thenadd up the
totals?
thanks


"MartinW" wrote:

Hi Randi,

Assuming your data is in A1:A4
In B1 put =SUM(LEFT(A1:A4,2)*1)
and in C1 put =SUM(RIGHT(A1:A4,1)*1)
Both formulae are array formulas so must be committed with
Ctrl+Shift+Enter and not just enter

HTH
Martin


"Randi" wrote in message
...
I have several columns (formatted as text) containing numbers with
dashes, i.e.,

20-1
15-2
30-4
05-3

Is there a way to add up the numbers separately in the column, i.e,
one total for the 20, 15, 20, 05 and one total for the 1, 2, 4, 3. If
unable
to add both is it possible to add up just the numbers to the left of
the
dash? Thanks.






  #7   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 28
Default Adding columns containing numbers with dashes

Thanks. I am a brand new user to Excel - hence the poor layout you've
referred to. Thanks for your halp.

"Peo Sjoblom" wrote:

Do you import these values, if not why are you using what is a really bad
layout?

The best way would be to make sure the column to the right is empty, then
select
the column with these values and do data text to columns, select delimited
and click next, then as delimiter select - and then click finish, then
simply use

=SUMPRODUCT(A1:A5,B1:B5)


Using Elkar's formula

=SUMPRODUCT(--(LEFT(A1:A10,FIND("-",A1:A10)-1)),--(MID(A1:A10,FIND("-",A1:A10)+1,99)))


however if there is a value without a dash or an empty cell it will return
an error



--
Regards,

Peo Sjoblom

"Randi" wrote in message
...
Thank you - that works - but now I need something different. How can I
change that formula to multiple the number to the left of the dash by the
number to the right of the dash, i.e., 40-2 = 80 and thenadd up the
totals?
thanks


"MartinW" wrote:

Hi Randi,

Assuming your data is in A1:A4
In B1 put =SUM(LEFT(A1:A4,2)*1)
and in C1 put =SUM(RIGHT(A1:A4,1)*1)
Both formulae are array formulas so must be committed with
Ctrl+Shift+Enter and not just enter

HTH
Martin


"Randi" wrote in message
...
I have several columns (formatted as text) containing numbers with
dashes, i.e.,

20-1
15-2
30-4
05-3

Is there a way to add up the numbers separately in the column, i.e,
one total for the 20, 15, 20, 05 and one total for the 1, 2, 4, 3. If
unable
to add both is it possible to add up just the numbers to the left of
the
dash? Thanks.






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
Adding Dashes to a 25 digit alphanumeric cell Nick Excel Discussion (Misc queries) 7 August 27th 07 05:02 PM
Adding and subtracting many columns numbers WoodyAccess Excel Worksheet Functions 1 January 2nd 07 01:02 PM
Convert phone numbers with dashes in them to just numbers J H Excel Discussion (Misc queries) 2 June 23rd 06 02:40 AM
ADDING NUMBERS IN COLUMNS ACROSS IN EXCEL lost in translation Excel Worksheet Functions 2 February 4th 05 10:40 PM
problem with adding columns of numbers jeri_g Excel Worksheet Functions 1 January 11th 05 03:25 PM


All times are GMT +1. The time now is 06:12 PM.

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"