BITPOSITION

Iron Contributor

Dear Experts,

                    Could you please share the formula, on how to Extract the Bit-position of k0,k1,k2,k3 in below excel.

anupambit1797_0-1679690033286.png

Thanks in Advance,

Br,

Anupam

 

4 Replies

@anupambit1797 

=INDEX($C$1:$J$1,LARGE(IF($C$2:$J$2=1,COLUMN($C$2:$J$2)),COLUMN(A$1))-2)

You can try this formula. Enter the formula with ctrl+shift+enter as an arrayformula if you don't work with Office365 or Excel 2021.

 

Can we use OFFSET function or any BIT operation as well ?

Br,
Anupam

Hi

Try this

=LET(m,(C1:J1+1)*C2:J2,SORT(FILTER(m,m>0),,,TRUE)-1)

 

@anupambit1797 

@anupambit1797 

 

First, I converted your DEC2BIT result to an array with:

 

=1*MID(B2,SEQUENCE(,LEN(B2)),1)

 

 Then the formula for bit position:

 

=LET(filtered,FILTER(BITPosition,C2#<>0),r,COLUMNS(filtered),INDEX(filtered,,SEQUENCE(,r,4,-1)))