How can I complement binary numbers so that 0 becomes 1 and 1 becomes
0. Also, is there a way to reverse the order of binary digits (i.e.
write backward)?
How can I complement binary numbers so that 0 becomes 1 and 1 becomes
0. Also, is there a way to reverse the order of binary digits (i.e.
write backward)?
One way:
Assuming your binary numbers are less than or equal to 10 binary digits,
and you have the Analysis Toolpak Add-in installed (Tools/Add-ins...):
=RIGHT(DEC2BIN(-BIN2DEC(A1)-1),LEN(A1))
In article <1124314805.887026.131450@f14g2000cwb.googlegroups.com>,
"RK" <rskim119@yahoo.com> wrote:
> How can I complement binary numbers so that 0 becomes 1 and 1 becomes
> 0.
RK wrote...
>How can I complement binary numbers so that 0 becomes 1 and 1 becomes
>0. Also, is there a way to reverse the order of binary digits (i.e.
>write backward)?
First question:
=TEXT(SUMPRODUCT(1-MID(x,ROW(INDIRECT("1:"&LEN(x))),1),
10^(LEN(x)-ROW(INDIRECT("1:"&LEN(x))))),REPT("0",LEN(x)))
Second question:
=TEXT(SUMPRODUCT(--MID(x,ROW(INDIRECT("1:"&LEN(x))),1),
10^(ROW(INDIRECT("1:"&LEN(x)))-1)),REPT("0",LEN(x)))
This only works for 15 or fewer binary digits. You'd have to chop up
longer binary numbers into 8-byte portions, apply these formulas to the
pieces, then concatenate their results to give the desired results.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks