Forum Discussion
DATA VALIDATION
A B
Formula | Description (Result) |
=DEC2BIN(9, 4) | Converts decimal 9 to binary with 4 characters (1001) |
=DEC2BIN(-100) | Converts decimal -100 to binary (1110011100) |
Convert numbers to different number systems
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
- NikolinoDENov 30, 2020Platinum Contributor
I am sure if you searched there would be loads of examples of this, but here is a quick function I knocked up for you:
Option Explicit Public Function LongBinary(lngNumber As Long) As String Dim lngExp As Long Dim strBinary If lngNumber < 0 Then Exit Function Do While 2 ^ lngExp <= lngNumber strBinary = -((lngNumber And (2 ^ lngExp)) <> 0) & strBinary lngExp = lngExp + 1 Loop LongBinary = strBinary End FunctionI would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
- NikolinoDENov 30, 2020Platinum ContributorIt is helpful to know the operating system and Excel version.
As different approaches may be required depending on the version and OS or it doesn't work with the Excel version available.
Thank you for your patience and time.
Nikolino
I know I don't know anything (Socrates)