Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default My problems with simple addition ...

where I have ...
Dim bn_all, ap_all, reuters_all, others_all, lat_all As Long

Set bn_range = Worksheets("Input").Range("b" & row & ":b40000")
Set ap_range = Worksheets("Input").Range("c" & row & ":c40000")
Set reuters_range = Worksheets("Input").Range("d" & row & ":d40000")
Set others_range = Worksheets("Input").Range("e" & row & ":e40000")


bn_all = Application.WorksheetFunction.Sum(bn_range) ' = 835.5
ap_all = Application.WorksheetFunction.Sum(ap_range) ' = 447
reuters_all = Application.WorksheetFunction.Sum(reuters_range) ' = 467
others_all = Application.WorksheetFunction.Sum(others_range) '= 117

why does this:

lat_all = bn_all + ap_all + reuters_all + others_all = 1886 and not
1886.5 ????


even when I set lat_range
tia ...


Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default My problems with simple addition ...

Is he variable lat_all defined as an integer or Long?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Larry Levinson" wrote in message
...
where I have ...
Dim bn_all, ap_all, reuters_all, others_all, lat_all As Long

Set bn_range = Worksheets("Input").Range("b" & row & ":b40000")
Set ap_range = Worksheets("Input").Range("c" & row & ":c40000")
Set reuters_range = Worksheets("Input").Range("d" & row & ":d40000")
Set others_range = Worksheets("Input").Range("e" & row & ":e40000")


bn_all = Application.WorksheetFunction.Sum(bn_range) ' = 835.5
ap_all = Application.WorksheetFunction.Sum(ap_range) ' = 447
reuters_all = Application.WorksheetFunction.Sum(reuters_range) ' = 467
others_all = Application.WorksheetFunction.Sum(others_range) '= 117

why does this:

lat_all = bn_all + ap_all + reuters_all + others_all = 1886 and not
1886.5 ????


even when I set lat_range
tia ...


Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default My problems with simple addition ...


-----Original Message-----
where I have ...
Dim bn_all, ap_all, reuters_all, others_all, lat_all As

Long

Set bn_range = Worksheets("Input").Range("b" & row

& ":b40000")
Set ap_range = Worksheets("Input").Range("c" & row

& ":c40000")
Set reuters_range = Worksheets("Input").Range("d" & row

& ":d40000")
Set others_range = Worksheets("Input").Range("e" & row

& ":e40000")


bn_all = Application.WorksheetFunction.Sum(bn_range) '

= 835.5
ap_all = Application.WorksheetFunction.Sum(ap_range) '

= 447
reuters_all = Application.WorksheetFunction.Sum

(reuters_range) ' = 467
others_all = Application.WorksheetFunction.Sum

(others_range) '= 117

why does this:

lat_all = bn_all + ap_all + reuters_all + others_all =

1886 and not
1886.5 ????


even when I set lat_range
tia ...


Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)
.

Because you defined your data as long !
try with variant or double
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default My problems with simple addition ...

Long, but it works if I set it to Single, thanks.


"Bob Phillips" wrote:

Is he variable lat_all defined as an integer or Long?


Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default My problems with simple addition ...

Looking at your post I can see the Long definition now, but I couldn't when
I answered. If it could be a big number, might be better to use Double.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Larry Levinson" wrote in message
...
Long, but it works if I set it to Single, thanks.


"Bob Phillips" wrote:

Is he variable lat_all defined as an integer or Long?


Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)



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
simple addition pitydafool Excel Discussion (Misc queries) 4 January 30th 09 10:44 PM
Simple Addition Function sneal Excel Worksheet Functions 3 September 11th 08 07:36 PM
simple currency addition in cell without having to enter decimal John Excel Worksheet Functions 8 November 16th 06 04:36 PM
Excel Standard Toolbar button addition/removal problems? Valerie Dyet Excel Discussion (Misc queries) 1 July 13th 05 10:01 PM
help with simple addition formula Juco Excel Worksheet Functions 1 January 29th 05 12:51 PM


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