Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 516
Default How to match bits to a certain value

I don't think this is very hard, but I'm not sure how to approach it.

Basically I have an 8 bit binary code that represents a decimal value
between 0 and 255, and each of the 8 bits represents a different color. By
either using the decimal or binary number, I need to output the corresponding
color.

Say the 8 bits are equivalent to ROYGBIVP (8 colors). ie bit 7=Red, bit 6=
Orange, bit 5=yellow, etc., down to bit 0=purple.

So, if I have 00001011 (decimal 8+2+1=11), then I would output BVP

or, if I have 11010000 (decimal 128+64+16= 128), then I would output ROG

It doesn't matter if you use the binary (to match bit by bit) or decimal
(using remainder function, even, odd, ,<, etc., or anything else I don't
know about).

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,688
Default How to match bits to a certain value

What are you looking for here? Do you want this to be part of some VB code
or do you have the data in worksheet cells and need a formula?

So, any solution is better than NO solution, right? How about an IF formula?

Binary *TEXT* string in A1.

A1 = 00001011

=IF(MID(A2,1,1)="1","R","")&IF(MID(A2,2,1)="1","O" ,"")&IF(MID(A2,3,1)="1","Y","")&IF(MID(A2,4,1)="1" ,"G","")&IF(MID(A2,5,1)="1","B","")&IF(MID(A2,6,1) ="1","I","")&IF(MID(A2,7,1)="1","V","")&IF(MID(A2, 8,1)="1","P","")

Returns: BVP

Biff

"matt" wrote in message
...
I don't think this is very hard, but I'm not sure how to approach it.

Basically I have an 8 bit binary code that represents a decimal value
between 0 and 255, and each of the 8 bits represents a different color.
By
either using the decimal or binary number, I need to output the
corresponding
color.

Say the 8 bits are equivalent to ROYGBIVP (8 colors). ie bit 7=Red, bit 6=
Orange, bit 5=yellow, etc., down to bit 0=purple.

So, if I have 00001011 (decimal 8+2+1=11), then I would output BVP

or, if I have 11010000 (decimal 128+64+16= 128), then I would output ROG

It doesn't matter if you use the binary (to match bit by bit) or decimal
(using remainder function, even, odd, ,<, etc., or anything else I don't
know about).

Thanks.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Match Index cjjoo Excel Worksheet Functions 3 October 25th 05 09:33 AM
Look up data in colum a and find match in colum b Chris(new user) Excel Discussion (Misc queries) 1 March 22nd 05 01:41 PM
Look up data in colum a and find match in colum b Chris(new user) Excel Discussion (Misc queries) 1 March 19th 05 09:27 PM
Find a match that;s not exact Phyllis Excel Worksheet Functions 0 November 8th 04 08:12 PM
Vlookup, Index & Match Phyllis Excel Worksheet Functions 1 November 8th 04 06:11 PM


All times are GMT +1. The time now is 02:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"