Another tough problem

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
Here’s a little challenge to add to PGC’s “tough problems”.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
Using only a worksheet formula, return the negative of a 4-bit binary number in binary without using any of Excel’s number base functions (DEC2BIN(), BIN2DEC(), BIN2HEX(), etc.).
<o:p> </o:p>
e.g:
9 in binary is “1001” and -9 is “0111”, so starting with “1001”, return the result “0111”.
<o:p> </o:p>
Rules:
Shortest formula wins
No VBA – only worksheet formulae
No use of number base functions
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
0111 looks like a 7 to me? Shouldn't you be using a sign bit at the front to indicate whether negative or positive?
 
Richard – Apologies, should have been more clear. Make the binary number negative using two’s compliment method:
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
http://en.wikipedia.org/wiki/Two's_complement
 

Forum statistics

Threads
1,222,653
Messages
6,167,358
Members
452,111
Latest member
NyVmex

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top