![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a number that may contain a decimal portion: 1.00, 1.33, 40.25. I need to separate this number to two different fields: 1 and 0, 1 and 33 and 40 and 25. Any ideas? |
#3
| |||
| |||
|
|
I have a number that may contain a decimal portion: 1.00, 1.33, 40.25. I need to separate this number to two different fields: 1 and 0, 1 and 33 and 40 and 25. Any ideas? |
#4
| |||
| |||
|
|
On Dec 16, 1:27 pm, Annette <annet... (AT) co (DOT) saint-croix.wi.us> wrote: I have a number that may contain a decimal portion: 1.00, 1.33, 40.25. I need to separate this number to two different fields: 1 and 0, 1 and 33 and 40 and 25. Any ideas? This is good for 0, 1, or 2 digits. You can get the whole numberwith Clng(var) and the decimal with Clng((var - clng(var)) * 100) Ex: Var = 1.01 ? Clng(var) 'dollar 1 |
#5
| |||
| |||
|
|
I have a number that may contain a decimal portion: 1.00, 1.33, 40.25. I need to separate this number to two different fields: 1 and 0, 1 and 33 and 40 and 25. Any ideas? |
#6
| |||
| |||
|
|
Patrick Finucane wrote: On Dec 16, 1:27 pm, Annette <annet... (AT) co (DOT) saint-croix.wi.us> wrote: I have a number that may contain a decimal portion: 1.00, 1.33, 40.25. I need to separate this number to two different fields: 1 and 0, 1 and 33 and 40 and 25. Any ideas? This is good for 0, 1, or 2 digits. You can get the whole numberwith * Clng(var) and the decimal with * Clng((var - clng(var)) * 100) Ex: Var = 1.01 ? Clng(var) *'dollar * *1 :-) Try 1.54 |

#7
| |||
| |||
|
|
A VBA example that uses no calculations: Dim varNumber As Variant Dim dblNumber as Double Dim lngNumber1 As Long Dim lngNumber2 As Long dblNumber = 40.25 varNumber = Split(CStr(dblNumber), ".") lngNumber1 = CInt(varNumber(0)) * ' Whole number part of number lngNumber2 = CInt(varNumber(1)) * ' Decimal number part of number In the above, lngNumber1 will contain the value 40 and lngNumber2 will contain the value 25. -- * * * * Ken Snellhttp://www.accessmvp.com/KDSnell/ "Annette" <annet... (AT) co (DOT) saint-croix.wi.us> wrote in message news:a92643df-cc57-489d-831e-f5ccb264fd9b (AT) f33g2000yqh (DOT) googlegroups.com... I have a number that may contain a decimal portion: 1.00, 1.33, 40.25. I need to separate this number to two different fields: 1 and 0, 1 and 33 and 40 and 25. Any ideas? |
#8
| |||
| |||
|
|
I have a number that may contain a decimal portion: 1.00, 1.33, 40.25. I need to separate this number to two different fields: 1 and 0, 1 and 33 and 40 and 25. Any ideas? |
#9
| |||
| |||
|
|
I guess I'm curious why everyone wants to keep turning this into a VBA solution. |
#10
| |||
| |||
|
|
I guess I'm curious why everyone wants to keep turning this into a VBA solution. |
![]() |
| Thread Tools | |
| Display Modes | |
| |