How to work SUMIF function backwards to take decimal number to show active bit in status register

TS_711

New Member
Joined
Apr 16, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Using Excel to analyze IEEE 488.2 communication status output report to determine active bits for machine operation. Want to use Excel to break down the large status decimal number to and highlight in sheet. Currently doing this manually is time consuming but works. Think Excel can do this but having a time trying to think up the formula to make it function correctly.

Project details -
16 bit register which has a decimal from 1 to 32,768. The status output of the machine gives 8,622. Manually working from bit 16 (32,768) to 1 (1) can determine that bits 14, 9, 8, 6, 4, 3, 2 are active by using the SUMIF function in Excel. =SUMIFS(E4:E35,C4:C35,"X")
1713292892555.png


What function would be used to be able to enter the status decimal and have excel subtract the closest number and indicate it is active, then subtract next closest number, etc. In this example the manual operation would be 8622 - 8192 (bit 14) = 430 - 256 (bit 9) = 174 - 128 (bit 8) = 46 - 32 (bit 6) = 14 - 8 (bit 4) = 6 - 4 (Bit 3) = 2 - 2 (Bit 2) = 0.

This might be better in a VBA code but I'm not sure how to get Excel to examine the closest number to the number being subtracted from.

Thank you for your time and any given assistance.

TS_711
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
A formula idea, depending on whether you want the binary representation in one cell or spilled down a column...and whether some post-processing is needed to deliver x's and blanks:
MrExcel_20240415.xlsx
BCDEFGH
3Status DecimalActiveBitActiveActive
486221100100001101011100 
5221x
6341x
7481x
85160
96321x
107640
1181281x
1292561x
13105120
141110240
151220480
161340960
171481921x
1815163840
1916327680
Sheet3
Cell Formulas
RangeFormula
D4:D19D4=SEQUENCE(16)
E4:E19E4=2^(D4#-1)
F4F4=DEC2BIN(INT(MOD(B4,256^2)/256),8)&DEC2BIN(MOD(B4,256),8)
G4:G19G4=MID(DEC2BIN(INT(MOD(B4,256^2)/256),8)&DEC2BIN(MOD(B4,256),8),SEQUENCE(16,,16,-1),1)
H4:H19H4=LET(b,MID(DEC2BIN(INT(MOD(B4,256^2)/256),8)&DEC2BIN(MOD(B4,256),8),SEQUENCE(16,,16,-1),1),IF(b="1","x",""))
Dynamic array formulas.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,203
Messages
6,123,627
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top