Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Negative numbers

Hello,

Does anyone know how to create a formula that will allow
for a begining balance of $0.00 and then take away $20.00
to give you an ending balance of -$20.00. And then have
a begining balance of $-20.00 and take away $20.00 for a
total of -40.00 instead of $0.00. I keep getting a zero.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Negative numbers

One way:

A1: 0
A2: 20

B1: =A1 - A2 ==== -20
B2: =B1 - A2 ==== -40



In article ,
"Jessie" wrote:

Hello,

Does anyone know how to create a formula that will allow
for a begining balance of $0.00 and then take away $20.00
to give you an ending balance of -$20.00. And then have
a begining balance of $-20.00 and take away $20.00 for a
total of -40.00 instead of $0.00. I keep getting a zero.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Negative numbers

What formula are you using?
Are you subtracting or adding the $20?

"Jessie" wrote:

Hello,

Does anyone know how to create a formula that will allow
for a begining balance of $0.00 and then take away $20.00
to give you an ending balance of -$20.00. And then have
a begining balance of $-20.00 and take away $20.00 for a
total of -40.00 instead of $0.00. I keep getting a zero.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Negative numbers

Hi Jessie;

In VBA you can dim the value as an Interger or a Long, do
the math in memory and then write it to a cell. An
example might be

Sub try()

MyValue = Int(activecell) - 20
activecell = MyValue

End Sub

Thanks

Greg

-----Original Message-----
Hello,

Does anyone know how to create a formula that will allow
for a begining balance of $0.00 and then take away $20.00
to give you an ending balance of -$20.00. And then have
a begining balance of $-20.00 and take away $20.00 for a
total of -40.00 instead of $0.00. I keep getting a zero.
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Negative numbers

Hi Greg,

Since Jessie is clearly dealing with currency calculations, it would not
seem appropriate to dim your variable as either long or integer.

Further, why would you advocate using the Int function?

---
Regards,
Norman



"GJones" wrote in message
...
Hi Jessie;

In VBA you can dim the value as an Interger or a Long, do
the math in memory and then write it to a cell. An
example might be

Sub try()

MyValue = Int(activecell) - 20
activecell = MyValue

End Sub

Thanks

Greg

-----Original Message-----
Hello,

Does anyone know how to create a formula that will allow
for a begining balance of $0.00 and then take away $20.00
to give you an ending balance of -$20.00. And then have
a begining balance of $-20.00 and take away $20.00 for a
total of -40.00 instead of $0.00. I keep getting a zero.
.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Negative numbers

Actually, for a completely different reason, Long might well be a good
way to go.

Longs will avoid many of the problems introduced by small rounding
errors in IEEE double precision floating point math. Values can be
internally multiplied and divided by 100 to match the currency
requirements.


So try() could be rewritten:

Public Sub try()
Dim MyValue As Long
With ActiveCell
MyValue = .Value * 100& - 2000&
.Value = MyValue \ 100&
End With
End Sub

However, I don't think that was the original responder's intention.


In article ,
"Norman Jones" wrote:

Since Jessie is clearly dealing with currency calculations, it would not
seem appropriate to dim your variable as either long or integer.

Further, why would you advocate using the Int function?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Negative numbers

Hi JE,

Longs will avoid many of the problems introduced by small rounding
errors in IEEE double precision floating point math. Values can be
internally multiplied and divided by 100 to match the currency
requirements.


Excellent and well-made point!

---
Regards,
Norman




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Negative numbers

Personal preference is to use the "Currency" data type to help avoid the
small rounding issues. Depending of course on what one is doing...
Dana DeLouis

"JE McGimpsey" wrote in message
...
Actually, for a completely different reason, Long might well be a good
way to go.

Longs will avoid many of the problems introduced by small rounding
errors in IEEE double precision floating point math. Values can be
internally multiplied and divided by 100 to match the currency
requirements.


So try() could be rewritten:

Public Sub try()
Dim MyValue As Long
With ActiveCell
MyValue = .Value * 100& - 2000&
.Value = MyValue \ 100&
End With
End Sub

However, I don't think that was the original responder's intention.


In article ,
"Norman Jones" wrote:

Since Jessie is clearly dealing with currency calculations, it would not
seem appropriate to dim your variable as either long or integer.

Further, why would you advocate using the Int function?



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, change column of negative numbers to positive numbers? Nita New Users to Excel 3 November 27th 07 04:54 AM
Excel 2002 : Convert Positive Numbers to Negative Numbers ? Mr. Low Excel Discussion (Misc queries) 2 November 6th 06 03:30 PM
Set negative numbers to zero. Do not calculate with negative valu Excel Headache Excel Discussion (Misc queries) 4 September 14th 06 08:56 PM
change 2000 cells (negative numbers) into positive numbers lisbern Excel Worksheet Functions 2 August 16th 06 05:54 PM
convert negative numbers to positive numbers and vice versa bill gras Excel Worksheet Functions 4 December 7th 05 01:39 AM


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