From: Reg on
elegant!


"Gary''s Student" wrote:

> In A1 enter:
>
> 11011011001110010101001110101011101011
> as text
>
> in B1, enter:
> =LEN(A1)-LEN(SUBSTITUTE(A1,"1","")) to display 23
>
> --
> Gary''s Student - gsnu200828
>
>
> "Sanford Lefkowitz" wrote:
>
> > This might be more of a math question than Excel.
> >
> > I have an application for which I would like to know the number of "1"s in
> > the binary representation of a number. For example 20 in binary is 10100,
> > which has 2 "1"s. I do not necessarily need the binary number itself.
> >
> > Also, the DEC2BIN function does not work for numbers >=512. Are there other
> > binary converters that do?
> >
> > Thanks
> > Sanford
From: Bernd P on
On 12 Mai, 15:01, Reg <R...(a)discussions.microsoft.com> wrote:
> elegant!
>
>
>
> "Gary''s Student" wrote:
> > In A1 enter:
>
> > 11011011001110010101001110101011101011
> > as text
>
> > in B1, enter:
> > =LEN(A1)-LEN(SUBSTITUTE(A1,"1","")) to display 23
>
> > --
> > Gary''s Student - gsnu200828
>
> > "Sanford Lefkowitz" wrote:
>
> > > This might be more of a math question than Excel.
>
> > > I have an application for which I would like to know the number of "1"s in
> > > the binary representation of a number. For example 20 in binary is 10100,
> > > which has 2 "1"s. I do not necessarily need the binary number itself.
>
> > > Also, the DEC2BIN function does not work for numbers >=512. Are there other
> > > binary converters that do?
>
> > > Thanks
> > > Sanford- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

=LEN(SUBSTITUTE(A1,"0",""))