Binary bit analysis

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here's my situation, I need to be able to get this sort of response:

I have a 32 bit binary word, each bit corresponds to a certain alarm. So if
a certain bit in the word is 1 then that alarm is flagged, however if several
bits are 1 then all the corresponding alarms are flagged.

Is there some way to use some sort of lookup table which will show which
alarms have been triggered?
 
I don't know how you want to display the results, but using =MID(A1,x,1)
where x is 1 to 32 will return the value of that bit. You can ite this in
with an IF statement to give something like
=IF(MID(A1,x,1)=1,"Alarm","Noalarm"). Note that this counts from the left,
so changing x to 1 will return the MSB.
 
I'm afraid you didn't notice that Madman wrote 32 bits and not bytes!
Stefi


„Ian†ezt írta:
 
Put your word (integer) into cell A1, select cells B1:B28 and enter
=MOD(INT($A$1/(2^(ROW()-1))),2)
with CTRL+SHIFT+ENTER (as array formula).

This will work for 28 bits (highest possible number: 268,435,455).

HTH,
Bernd
 
I tried it, but it gave zero in all cells B1:B28 for any value in A1!
What's wrong?
Stefi


„Bernd Plumhoff†ezt írta:
 
Stefi said:
I'm afraid you didn't notice that Madman wrote 32 bits and not bytes!
Stefi
Yes, I did. I am assuming this 32bit binary word is a string of 32 zeros &
ones, each character representing 1 bit. If this is not the case, then
perhaps MadManInABox could enlighten me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top