Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 36
Default Sum of individual digits (just for fun)

I want to sum how often a certain digit (for example 1) appear in
the in the sequence of whole numbers 1, 2, ,...., N

N 1 10 11 21 ....
f(N) 1 2 4 13 ....

N=21 --- f(N)= number of ones in {1, 10, 11, 12, 13, 14 ,15 ,16,
17 ,18, 19, 21}=13

I have mmade an attempt with the following array formula:
=CODE(MID(A1,ROW(INDIRECT("1:"&LEN(A11))),1))
which for N=1 returns 49, for N=10 returns {49,48} and so on.
How can I extend above formula (count the "49's") so that I get the
results shown under
f(N) or maybe a better way?

Hans Knudsen

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default Sum of individual digits (just for fun)

Hi Hans

Try this for every 1 in A1:A10

=SUMPRODUCT(--(LEN(A1:A10)-LEN(SUBSTITUTE(A1:A10,"1",""))))

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Hans Knudsen" wrote in message ...
I want to sum how often a certain digit (for example 1) appear in the in the sequence of whole numbers 1, 2, ,...., N

N 1 10 11 21 ....
f(N) 1 2 4 13 ....

N=21 --- f(N)= number of ones in {1, 10, 11, 12, 13, 14 ,15 ,16, 17 ,18, 19, 21}=13

I have mmade an attempt with the following array formula:
=CODE(MID(A1,ROW(INDIRECT("1:"&LEN(A11))),1))
which for N=1 returns 49, for N=10 returns {49,48} and so on.
How can I extend above formula (count the "49's") so that I get the results shown under
f(N) or maybe a better way?

Hans Knudsen



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 36
Default Sum of individual digits (just for fun)

Hi Ron
Of course. How simple can it be!
Thank you very much.

Regards
Hans



"Ron de Bruin" skrev i en meddelelse
...
Hi Hans

Try this for every 1 in A1:A10

=SUMPRODUCT(--(LEN(A1:A10)-LEN(SUBSTITUTE(A1:A10,"1",""))))

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Hans Knudsen" wrote in message
...
I want to sum how often a certain digit (for example 1) appear in
the in the sequence of whole numbers 1, 2, ,...., N

N 1 10 11 21 ....
f(N) 1 2 4 13 ....

N=21 --- f(N)= number of ones in {1, 10, 11, 12, 13, 14 ,15
,16, 17 ,18, 19, 21}=13

I have mmade an attempt with the following array formula:
=CODE(MID(A1,ROW(INDIRECT("1:"&LEN(A11))),1))
which for N=1 returns 49, for N=10 returns {49,48} and so on.
How can I extend above formula (count the "49's") so that I get
the results shown under
f(N) or maybe a better way?

Hans Knudsen




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
maximum number size/significant digits noel Excel Discussion (Misc queries) 4 February 20th 06 03:42 PM
Mistery digits on excel Bewilder Excel Discussion (Misc queries) 2 October 5th 05 06:28 PM
excel floating digits error Bewilder Excel Discussion (Misc queries) 3 October 5th 05 05:56 PM
Count individual digits James Excel Discussion (Misc queries) 11 April 28th 05 07:44 PM
loop trough e-mail address list to send task lists with outlook Paul. Excel Discussion (Misc queries) 2 April 14th 05 11:48 AM


All times are GMT +1. The time now is 09:08 AM.

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"