Link to home
Start Free TrialLog in
Avatar of d-glitch
d-glitchFlag for United States of America

asked on

Strange behavior with Excel - 2-56 = 20486 and 8-32 = 11902 ????

Strange behavior with Excel - 2-56 = 20486   and   8-32 = 11902 ????

I was trying to type ANSI Machine Screw Sizes.  They are all weird.  

I can get it work with a leading quote or space, but how is Excel coming up with these numbers?
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of phoffric
phoffric

If you format the cell as number, and enter
=2-56

Open in new window

what do you get?
Using VBA you can do something like this, which in this case adds an an apostrophe at the start of every used cell on the sheet.

Dim cel As Range
For Each cel In ActiveSheet.UsedRange 
        cel.Value = "'" & cel.Value 
Next cel 

Open in new window

Prior to entering values set the format of that column to Text and it will just show what you enter so entering 2-56 will show as that and not be converted to a date.
Avatar of d-glitch

ASKER

Thanks, I'm better now.  Bad case of unexpected operator overloading.

Subtract   8-32 = 11902.00

Divide:        8/32 = 0.25   (no equal sign required)

Divide:         8/1/32 = 11902.00
Twice