View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default How can I do AND operation on two binary numbers in MS Excel?

If you set a vba library reference to "atpvbaen.xls", then the following
returns the string "1001"

Sub Demo()
Dim s1, s2, Answer
s1 = "00101001"
s2 = "10001001"

' Returns 1001
Answer = Dec2Bin(Bin2Dec(s1) And Bin2Dec(s2))
End Sub

HTH
--
Dana DeLouis
Win XP & Office 2003


"Zuke" wrote in message
...
I want to do AND say to the following:
00101001
AND to
10001001

and should get the following answer:

00001001

What function should I use in MS Excel to get this?