Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Divide entire column by 100

I have a spreadsheet where the currency value are formatted incorrectly.
Values of
227.00 are shown as $22,700.00, 136.00 is shown as $13,600.00 aqnd 1331.00
is shown as 133,100.00. I need all the values in column I to be divided by
100 with the $ sign omitted. Can anybody help me with the VB code for this.
Thanks so much

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Divide entire column by 100

put 100 in a cell

copy it

select column A, then paste special
click divide under operation

then just format the column without the $ with 2 decimal.

--


Gary


"SITCFanTN" wrote in message
...
I have a spreadsheet where the currency value are formatted incorrectly.
Values of
227.00 are shown as $22,700.00, 136.00 is shown as $13,600.00 aqnd 1331.00
is shown as 133,100.00. I need all the values in column I to be divided by
100 with the $ sign omitted. Can anybody help me with the VB code for this.
Thanks so much



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Divide entire column by 100

Before you go dividing by 100, let's make sure we know what is going on. If
you select the cell that says $22,700.00 (but is supposed to be 227), what
does it say in the Formula Bar? Also, right-click the cell, select the
Format Cells item from the popup menu that appears and click the Number tab
on the dialog box that appears. What item in the Category listing is
selected? If there are any listings or fields shown under the Sample field,
what values are in them?

Rick


"SITCFanTN" wrote in message
...
I have a spreadsheet where the currency value are formatted incorrectly.
Values of
227.00 are shown as $22,700.00, 136.00 is shown as $13,600.00 aqnd 1331.00
is shown as 133,100.00. I need all the values in column I to be divided
by
100 with the $ sign omitted. Can anybody help me with the VB code for
this.
Thanks so much


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Divide entire column by 100

Thanks Rick for your help...here are the answers to your questions

Question 1 = 22700
Question 2= Currency
Data in Sample field = $22,700.00

I need the pennies to show so what I need the field to look like is 227.00.

I hope this helps, thanks so much.

"Rick Rothstein (MVP - VB)" wrote:

Before you go dividing by 100, let's make sure we know what is going on. If
you select the cell that says $22,700.00 (but is supposed to be 227), what
does it say in the Formula Bar? Also, right-click the cell, select the
Format Cells item from the popup menu that appears and click the Number tab
on the dialog box that appears. What item in the Category listing is
selected? If there are any listings or fields shown under the Sample field,
what values are in them?

Rick


"SITCFanTN" wrote in message
...
I have a spreadsheet where the currency value are formatted incorrectly.
Values of
227.00 are shown as $22,700.00, 136.00 is shown as $13,600.00 aqnd 1331.00
is shown as 133,100.00. I need all the values in column I to be divided
by
100 with the $ sign omitted. Can anybody help me with the VB code for
this.
Thanks so much



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Divide entire column by 100

Okay, that answer raises some more questions and/or possible solutions. Note
the emphasis in the following... IF you will NOT be using these values in
any further/future calculations, then you can make the value "look" like
what you want (but note that it will NOT actually be that value; hence the
caution about future use) by simply formatting the entry. Just use the same
procedure I asked you to follow in my previous response and select Custom
from the Category list and put 0\.00 in the Type field.

However, I'm willing to be you will want to use this value in other
calculations. If that is the case, my first question is why not use standard
entries? For 227, just type in 227 and, also, remove the format from the
cells in that column (change the Currency selection to General in the
Formatting Cells dialog). For values with penny amounts, just type in the
decimal point where it would normally be. Do you really think the saving
from typing this on additional character is worth the trouble it causes?

If you are insistent on not typing in the decimal point, then my next
question is... will you be creating all your entries in this column only one
time? If so, follow the procedure Gary laid out for you. If you will be
making multiple entries in this column over time, then you will need an
event procedure to handle adjusting the value. To do this, right click the
tab for the worksheet with this column on it and select View Code from the
menu that pops up. Copy/Past the following into the code window that
appears...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then
On Error GoTo Whoops
If InStr(Target.Value, ".") = 0 Then
Application.EnableEvents = False
Target.Value = Target.Value / 100
Application.EnableEvents = True
On Error GoTo 0
End If
End If
Exit Sub
Whoops:
Application.EnableEvents = True
End Sub

Oh, and make sure to remove the format from the cells in that column (change
the Currency selection to General in the Formatting Cells dialog).

Rick


"SITCFanTN" wrote in message
...
Thanks Rick for your help...here are the answers to your questions

Question 1 = 22700
Question 2= Currency
Data in Sample field = $22,700.00

I need the pennies to show so what I need the field to look like is
227.00.

I hope this helps, thanks so much.

"Rick Rothstein (MVP - VB)" wrote:

Before you go dividing by 100, let's make sure we know what is going on.
If
you select the cell that says $22,700.00 (but is supposed to be 227),
what
does it say in the Formula Bar? Also, right-click the cell, select the
Format Cells item from the popup menu that appears and click the Number
tab
on the dialog box that appears. What item in the Category listing is
selected? If there are any listings or fields shown under the Sample
field,
what values are in them?

Rick


"SITCFanTN" wrote in message
...
I have a spreadsheet where the currency value are formatted incorrectly.
Values of
227.00 are shown as $22,700.00, 136.00 is shown as $13,600.00 aqnd
1331.00
is shown as 133,100.00. I need all the values in column I to be
divided
by
100 with the $ sign omitted. Can anybody help me with the VB code for
this.
Thanks so much






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Divide entire column by 100

On Apr 4, 1:58*pm, "Rick Rothstein \(MVP - VB\)"
wrote:
Okay, that answer raises some more questions and/or possible solutions. Note
the emphasis in the following... IF you will NOT be using these values in
any further/future calculations, then you can make the value "look" like
what you want (but note that it will NOT actually be that value; hence the
caution about future use) by simply formatting the entry. Just use the same
procedure I asked you to follow in my previous response and select Custom
from the Category list and put 0\.00 in the Type field.

However, I'm willing to be you will want to use this value in other
calculations. If that is the case, my first question is why not use standard
entries? For 227, just type in 227 and, also, remove the format from the
cells in that column (change the Currency selection to General in the
Formatting Cells dialog). For values with penny amounts, just type in the
decimal point where it would normally be. Do you really think the saving
from typing this on additional character is worth the trouble it causes?

If you are insistent on not typing in the decimal point, then my next
question is... will you be creating all your entries in this column only one
time? If so, follow the procedure Gary laid out for you. If you will be
making multiple entries in this column over time, then you will need an
event procedure to handle adjusting the value. To do this, right click the
tab for the worksheet with this column on it and select View Code from the
menu that pops up. Copy/Past the following into the code window that
appears...

Private Sub Worksheet_Change(ByVal Target As Range)
* If Target.Column = 4 Then
* * On Error GoTo Whoops
* * If InStr(Target.Value, ".") = 0 Then
* * * Application.EnableEvents = False
* * * Target.Value = Target.Value / 100
* * * Application.EnableEvents = True
* * * On Error GoTo 0
* * End If
* End If
* Exit Sub
Whoops:
* Application.EnableEvents = True
End Sub

Oh, and make sure to remove the format from the cells in that column (change
the Currency selection to General in the Formatting Cells dialog).

Rick

"SITCFanTN" wrote in message

...



Thanks Rick for your help...here are the answers to your questions


Question 1 = 22700
Question 2= Currency
Data in Sample field = $22,700.00


I need the pennies to show so what I need the field to look like is
227.00.


I hope this helps, thanks so much.


"Rick Rothstein (MVP - VB)" wrote:


Before you go dividing by 100, let's make sure we know what is going on..
If
you select the cell that says $22,700.00 (but is supposed to be 227),
what
does it say in the Formula Bar? Also, right-click the cell, select the
Format Cells item from the popup menu that appears and click the Number
tab
on the dialog box that appears. What item in the Category listing is
selected? If there are any listings or fields shown under the Sample
field,
what values are in them?


Rick


"SITCFanTN" wrote in message
...
I have a spreadsheet where the currency value are formatted incorrectly.
Values of
227.00 are shown as $22,700.00, 136.00 is shown as $13,600.00 aqnd
1331.00
is shown as 133,100.00. *I need all the values in column I to be
divided
by
100 with the $ sign omitted. *Can anybody help me with the VB code for
this.
Thanks so much- Hide quoted text -


- Show quoted text -


Hi,

One thing I am not clear on is whether you want new data entered to be
divided by 100 (which appears to be Rick's interpretation from the
Worksheet_Change suggestion he offered, or if you have been given a
stack of data that is already in this format in which case Gary's
PasteSpecial method would be the simplest.
If you are keying this new data, one other suggestion would be to head
to 'Tools' - 'Options' - 'Edit' tab, and tick 'Fixed decimal places'
with a setting of -2. This will mean that every value you enter will
be automatically divided by 100 without having to run a Change macro.
If you already have the source data and it is not still being added
to, the following macro will do what you asked, but it does involve a
loop which Gary's method avoids:

Sub DivideCells()
Dim cell As Range

For Each cell In Range("I:I").SpecialCells(xlCellTypeConstants,
xlNumbers)
cell = cell.Value / 100
Next
Range("I:I").NumberFormat = "General"
End Sub

Cheers,
Ivan.
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Divide entire column by 100

On Thursday, April 3, 2008 8:42:00 PM UTC-5, SITCFanTN wrote:
I have a spreadsheet where the currency value are formatted incorrectly. Values of 227.00 are shown as $22,700.00, 136.00 is shown as $13,600.00 aqnd 1331.00 is shown as 133,100.00. I need all the values in column I to be divided by 100 with the $ sign omitted. Can anybody help me with the VB code for this. Thanks so much


Thanks a lot for your help..
Really appreciate it
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default Divide entire column by 100

hi,

write the number 100 in a cell, make a copy of this cell, select the range and do a paste special - division

--
isabelle



Le 2012-08-30 16:42, a écrit :
On Thursday, April 3, 2008 8:42:00 PM UTC-5, SITCFanTN wrote:
I have a spreadsheet where the currency value are formatted incorrectly.
Values of 227.00 are shown as $22,700.00, 136.00 is shown as $13,600.00 aqnd 1331.00 is shown as 133,100.00.
I need all the values in column I to be divided by 100 with the $ sign omitted. Can anybody help me with the VB code for this.


Thanks so much

Thanks a lot for your help..
Really appreciate it



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
divide column(x) by column(y) to give column(x/y) in excel? James New Users to Excel 2 April 24th 23 11:46 AM
IN COLUMN H =PRODUCT(B2.D2) DIVIDED BY 2 HOW DO I DIVIDE Pat[_6_] Setting up and Configuration of Excel 1 April 26th 10 10:00 AM
How do I divide a column into two? udowado Excel Discussion (Misc queries) 2 October 20th 06 11:45 PM
Looking for a formula that will divide a column & rows by 2 anchar Excel Worksheet Functions 2 August 12th 06 04:46 PM
how do I divide or multiply an entire column? 1number Excel Worksheet Functions 4 March 5th 05 08:48 PM


All times are GMT +1. The time now is 01:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"