LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default conversionof numeric data in word

"Bob Phillips" wrote...
seehttp://www.xldynamic.com/source/xld.xlFAQ0004.html

....

I'd use Laurent Longre's MOREFUNC.XLL add-in's NBTEXT function for
this.

As for a purely worksheet approach, 18 defined names seems a bit much.

With the defined names

_ones
=" one two three four five
six seven eight nine "

_teens
="ten eleven twelve thirteen fourteen fifteen
sixteen seventeen eighteen nineteen "

_tens
=" twenty thirty forty fifty
sixty seventy eighty ninety "

_s
=ROW(INDEX(Sheet1!$1:$65536,1,1):INDEX(Sheet1!$1:$ 65536,1000,1))-1

_0..999
=SUBSTITUTE(TRIM(IF(_s=100,MID(_ones,10*INT(_s/100)+1,10)
&" hundred ","")&IF(MOD(_s,100)=20,MID(_tens,
10*INT(MOD(_s,100)/10)+1,10)&MID(_ones,10*MOD(_s,10)+1,10),
MID(IF(INT(MOD(_s,100)/10)=1,_teens,_ones),10*MOD(_s,10)+1,10))),
"ty ","ty-")

5 defined names.

I could use a formula like the following to represent any number up to
999,999,999,999.99.

=IF(INT((N-10^12*INT(N/10^12))/10^9),INDEX(_0..999,
1+(N-10^12*INT(N/10^12))/10^9)&" billion ","")
&IF(INT((N-10^9*INT(N/10^9))/10^6),INDEX(_0..999,
1+(N-10^9*INT(N/10^9))/10^6)&" million ","")
&IF(INT((N-10^6*INT(N/10^6))/1000),INDEX(_0..999,
1+(N-10^6*INT(N/10^6))/1000)&" thousand ","")
&IF(INT(N-1000*INT(N/1000)),INDEX(_0..999,
1+N-1000*INT(N/1000)),"")&" and "&IF(ROUND(100*(N-INT(N)),2),
INDEX(_0..999,1+ROUND(100*(N-INT(N)),2)),"no")&" cents"

Note: this includes proper English hyphenation of numbers from 21 to
99 that aren't multiples of 10.

For proper English capitalization,

=SUBSTITUTE(PROPER(SUBSTITUTE(IF(INT((N-10^12*INT(N/10^12))/10^9),
INDEX(_0..999,1+(N-10^12*INT(N/10^12))/10^9)&" billion ","")
&IF(INT((N-10^9*INT(N/10^9))/10^6),INDEX(_0..999,
1+(N-10^9*INT(N/10^9))/10^6)&" million ","")
&IF(INT((N-10^6*INT(N/10^6))/1000),INDEX(_0..999,
1+(N-10^6*INT(N/10^6))/1000)&" thousand ","")
&IF(INT(N-1000*INT(N/1000)),INDEX(_0..999,
1+N-1000*INT(N/1000)),"")&" and "&IF(ROUND(100*(N-INT(N)),2),
INDEX(_0..999,1+ROUND(100*(N-INT(N)),2)),"no")&" cents","-","q")),
"q","-")

With 6 more defined names, so just 11 in total, defined with B13 as
the active cell,

_b
=IF(INT((!A17-10^12*INT(!A17/10^12))/10^9),
INDEX(_0..999,1+(!A17-10^12*INT(!A17/10^12))/10^9)&" billion ","")

_m
=IF(INT((!A17-10^9*INT(!A17/10^9))/10^6),
INDEX(_0..999,1+(!A17-10^9*INT(!A17/10^9))/10^6)&" million ","")

_t
=IF(INT((!A17-10^6*INT(!A17/10^6))/1000),
INDEX(_0..999,1+(!A17-10^6*INT(!A17/10^6))/1000)&" thousand ","")

_o
=IF(INT(!A17-1000*INT(!A17/1000)),
INDEX(_0..999,1+!A17-1000*INT(!A17/1000)),"")

_n2t
=SUBSTITUTE(PROPER(SUBSTITUTE(_b&_m&_t&_o&_f,"-","q")),"q","-")

I could use formulas like

=_n2t

to convert the number one column to the left into text form.

 
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
Word (text) with a numeric value...PLEASE HELP! officedrone Excel Discussion (Misc queries) 4 December 12th 06 05:07 PM
convert numeric to word MRIDUL Excel Discussion (Misc queries) 1 July 17th 06 05:00 PM
Numeric in Text to convert back to the form of Numeric for VLookup Purposes achilles Excel Discussion (Misc queries) 4 February 6th 06 07:05 AM
Match Single Numeric Criteria and Return Multiple Numeric Labels Sam via OfficeKB.com Excel Worksheet Functions 0 December 29th 05 08:44 PM
Print labels by using Excel data in a Word mail into word Zoey Excel Discussion (Misc queries) 1 November 1st 05 09:08 PM


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