Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
maa maa is offline
external usenet poster
 
Posts: 1
Default How to divide a number into various denominators

How to divide a number into various denominators eg thousands, hundreds,
tens, fives & ones for example 5527 can be divided into 5 (thousand), 5
(hundreds), 2(tens) & 7 (ones).
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default How to divide a number into various denominators

There's probably an easier way but try this with your number in A1:-

=INT(A1/1000)&" (Thousands) "&INT(RIGHT(A1,3)/100)& " (Hundreds)
"&INT(RIGHT(A1,2)/10)& " (Tens) "&INT(RIGHT(A1,1))& " (Ones)"

I haven't allow for decimals portions.

Mike

"maa" wrote:

How to divide a number into various denominators eg thousands, hundreds,
tens, fives & ones for example 5527 can be divided into 5 (thousand), 5
(hundreds), 2(tens) & 7 (ones).

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How to divide a number into various denominators

This uses a macro. Is that ok?

I put these values in B1:M1 (12 cells):
1000, 100, 50, 20, 10, 5, 1, 0.5, 0.25, 0.1, 0.05, 0.01

($1000 bill, $100 bill, $50, ..., thru a penny (.01))

I put this in A2: 1234.32

Then I added this function from Chip Pearson into a General module.

Option Explicit
Function ConvertToCurrency(ByVal Amt As Double) As Variant
Dim Ndx As Integer
Dim Counter As Integer
Dim Arr As Variant
Arr = Array(1000, 100, 50, 20, 10, 5, 1, 0.5, 0.25, 0.1, 0.05, 0.01)
For Ndx = LBound(Arr) To UBound(Arr)
Counter = 0
While (Amt + 0.001) = Arr(Ndx)
Counter = Counter + 1
Amt = Amt - Arr(Ndx)
Wend
Arr(Ndx) = Counter
Next Ndx
ConvertToCurrency = Arr
End Function

Then I selected B2:M2 and typed:
=converttocurrency(a2)
but instead of hitting enter, I hit ctrl-shift-enter.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

If you need more currency ($500), just add it to your headers, put it in the
code and select as many cells as required (12 will become 13 in my example).

Remember to hit ctrl-shift-enter to enter the formula.

maa wrote:

How to divide a number into various denominators eg thousands, hundreds,
tens, fives & ones for example 5527 can be divided into 5 (thousand), 5
(hundreds), 2(tens) & 7 (ones).


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default How to divide a number into various denominators

On Mon, 4 Jun 2007 04:38:00 -0700, maa wrote:

How to divide a number into various denominators eg thousands, hundreds,
tens, fives & ones for example 5527 can be divided into 5 (thousand), 5
(hundreds), 2(tens) & 7 (ones).


If you want to divide the 5527 into the values you mention, you would have,
instead of 7 (ones), 1(five) and 2 (ones).

In any event, for integers as you indicate, you can do the following.

Set up your top row as follows:

B1: $1,000
C1: $100
D1: $10
E1: $5
F1: $1

A2: $5,527

B2: =INT($A2/B$1)
C2: =INT(($A2-SUMPRODUCT($B$1:B$1,$B2:B2))/C$1)

Fill right C2:F2

Then fill down B2:F2 as far as you require.

If "cents" will be used, then add the value of the coins you want to use to
G1:x1

e.g. G1: $0.50
H1: $0.25

etc.

and change the formula in C2:

=INT(ROUND(($A2-SUMPRODUCT($B$1:B$1,$B2:B2))/C$1,2))

to take care of occasional issues with Excel's handling of decimal numbers.

Fill right and down as before.
--ron
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
12ths denominators for fractions in Excel (for pension calcs) pipey king Excel Worksheet Functions 1 August 25th 06 05:13 PM
Divide a number into multiple cells rhon101 Excel Discussion (Misc queries) 2 May 21st 06 06:43 AM
Function 2 divide a number (ie $1.00) by % (ie 25%) to = ($4.00)? Gonecoastal1 Excel Worksheet Functions 12 March 18th 06 03:27 AM
How do I divide a number by another number when there is no divis. Ursula New Users to Excel 1 April 4th 05 04:20 PM
Divide one row over other row I dont wont to divide one number Rick Excel Discussion (Misc queries) 0 March 4th 05 07:13 PM


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