Boolean masks

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

Guest

I want to use boolean masking eg 10011 AND 01011 should return 00011 but I
just keep getting TRUE or FALSE from the AND operator. Is there something
I'm missing or can EXCEL not do this?

Thanks for any help
 
Howard said:
I want to use boolean masking eg 10011 AND 01011 should return 00011 but I
just keep getting TRUE or FALSE from the AND operator. Is there something
I'm missing or can EXCEL not do this?

Thanks for any help

Not directly. You need to make a User Defined Function. Here's some VB6 code
that you can use.
http://www.devx.com/vb2themax/Tip/19306

/Fredrik
 
Howard,

VBA supports bitwise AND (and ORs). For example,

Dim X As Integer
Dim Y As Integer
Dim Z As Integer
X = 19 '10011
Y = 11 '01011
Z = X And Y ' Z = 3
Debug.Print Z


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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