Forum Discussion
Reverse_Bits
Dear Experts,
Could you please share a Formula on how can I reverse the bits from LSB to MSB in Column "C", with results in Column "D"
Thanks in Advance,
Br,
Anupam
anupambit1797 so i had some fun with this.
a) here is an alternative to create the dec2bin for large numbers (not claiming it to be more efficient just an alternative). It uses a recursive LAMBDA function:
=RIGHT(REPT("0",32)&d2b(A2),32) d2b = LAMBDA(in, IF(in>2,d2b(QUOTIENT(in,2)),in-1) & MOD(in,2))Here is the reverse bits:
=LET(in,D2,CONCAT(MID(in,SEQUENCE(LEN(in),,LEN(in),-1),1)))it could be more simple if you assume only for 32 bits:
=CONCAT(MID(D2,SEQUENCE(32,,32,-1),1))
2 Replies
- mtarlerSilver Contributor
anupambit1797 so i had some fun with this.
a) here is an alternative to create the dec2bin for large numbers (not claiming it to be more efficient just an alternative). It uses a recursive LAMBDA function:
=RIGHT(REPT("0",32)&d2b(A2),32) d2b = LAMBDA(in, IF(in>2,d2b(QUOTIENT(in,2)),in-1) & MOD(in,2))Here is the reverse bits:
=LET(in,D2,CONCAT(MID(in,SEQUENCE(LEN(in),,LEN(in),-1),1)))it could be more simple if you assume only for 32 bits:
=CONCAT(MID(D2,SEQUENCE(32,,32,-1),1)) - peiyezhuBronze Contributor00001100110111010101001010101001
00000110000000010101001010101001
what is your expected result from above bits?