Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default What 'value' is a Dec2Bin output?

I'm trying to verify that the guess someone makes as to the binary equivalent
of a decimal number is correct.

Example

cell A1 holds, say, 8

User must enter their 'estimate' of the binary value of 8 in cell B1

cell C1 formula: =IF(DEC2BIN(A1)=B1,"Yes","No")

I cannot get this to return a "Yes" when B1 = 1000

----

Strangely, what does work is if I use the 'reverse'
cell c1 formula: =IF(BIN2DEC(B1)=A1,"Yes","No")

Why doesn't Excel 'see' an entry of 1000 as being the same as an putput of
1000 from Dec2Bin?


--
It''s a little fit bunny, this feeling inside
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 837
Default What 'value' is a Dec2Bin output?

"EvilTony" wrote:

I'm trying to verify that the guess someone makes as to the binary equivalent
of a decimal number is correct.

Example

cell A1 holds, say, 8

User must enter their 'estimate' of the binary value of 8 in cell B1

cell C1 formula: =IF(DEC2BIN(A1)=B1,"Yes","No")

I cannot get this to return a "Yes" when B1 = 1000

----

Strangely, what does work is if I use the 'reverse'
cell c1 formula: =IF(BIN2DEC(B1)=A1,"Yes","No")

Why doesn't Excel 'see' an entry of 1000 as being the same as an putput of
1000 from Dec2Bin?


Excel doesn't see them as equal because the number 1000 is not the same as
the character string "1000".

Jerry
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default What 'value' is a Dec2Bin output?

Hi,

Convert the string to a number by adding zero

=IF(DEC2BIN(A1)+0=B1,"Yes","No")

Mike

"EvilTony" wrote:

I'm trying to verify that the guess someone makes as to the binary equivalent
of a decimal number is correct.

Example

cell A1 holds, say, 8

User must enter their 'estimate' of the binary value of 8 in cell B1

cell C1 formula: =IF(DEC2BIN(A1)=B1,"Yes","No")

I cannot get this to return a "Yes" when B1 = 1000

----

Strangely, what does work is if I use the 'reverse'
cell c1 formula: =IF(BIN2DEC(B1)=A1,"Yes","No")

Why doesn't Excel 'see' an entry of 1000 as being the same as an putput of
1000 from Dec2Bin?


--
It''s a little fit bunny, this feeling inside

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default What 'value' is a Dec2Bin output?

"Jerry W. Lewis" wrote:

Excel doesn't see them as equal because the number 1000 is not the same as

the character string "1000".

Jerry



I can see that, but how do I stop Ecel seeing the 1000 as a number?
When I format the cell as text the formula still returns a "No", indicating
that the text-string 1000 is not the same as the Dec2Bin(8).

What I am asking for is
A) what format does Excel see a cell as when it holds a Dec2Bin output?
B) how can I make a numerical value equate to a Dec2Bin output?
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default What 'value' is a Dec2Bin output?

Try

=IF(DELTA(DEC2BIN(A1),B1),"Yes","No")

If this post helps click Yes
---------------
Jacob Skaria


"EvilTony" wrote:

I'm trying to verify that the guess someone makes as to the binary equivalent
of a decimal number is correct.

Example

cell A1 holds, say, 8

User must enter their 'estimate' of the binary value of 8 in cell B1

cell C1 formula: =IF(DEC2BIN(A1)=B1,"Yes","No")

I cannot get this to return a "Yes" when B1 = 1000

----

Strangely, what does work is if I use the 'reverse'
cell c1 formula: =IF(BIN2DEC(B1)=A1,"Yes","No")

Why doesn't Excel 'see' an entry of 1000 as being the same as an putput of
1000 from Dec2Bin?


--
It''s a little fit bunny, this feeling inside



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default What 'value' is a Dec2Bin output?

You need to get them both to either numbers or text. Here's one way to turn
both into 8-character text strings to compa
=IF(TEXT(DEC2BIN(A1),"00000000")=TEXT(B1,"00000000 "),"YES","NO")


"EvilTony" wrote:

I'm trying to verify that the guess someone makes as to the binary equivalent
of a decimal number is correct.

Example

cell A1 holds, say, 8

User must enter their 'estimate' of the binary value of 8 in cell B1

cell C1 formula: =IF(DEC2BIN(A1)=B1,"Yes","No")

I cannot get this to return a "Yes" when B1 = 1000

----

Strangely, what does work is if I use the 'reverse'
cell c1 formula: =IF(BIN2DEC(B1)=A1,"Yes","No")

Why doesn't Excel 'see' an entry of 1000 as being the same as an putput of
1000 from Dec2Bin?


--
It''s a little fit bunny, this feeling inside

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default What 'value' is a Dec2Bin output?

"Jacob Skaria" wrote:

Try

=IF(DELTA(DEC2BIN(A1),B1),"Yes","No")



Thanks.
Thanks to all of you.

As Jakob's "Delta" function is immediately and plainly explained in the Help
pages, that's the one I'll be going with.

My students would not immediately appreciate the use of "text" with a
number, nor the idea of adding something (even a zero) to a number being
checked for correspondence.

Once again, thanks.
--
It''s a little fit bunny, this feeling inside



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default What 'value' is a Dec2Bin output?

Hi,

I agree Jacob's solution is very good but multiplication by 1 or the
addition of zero is a commonly used technique in Excel for converting text to
numbers.

If you read Excel help again for Delta I think you still have some
explaining to do to your students. For example

A1=8
A2 =DEC2BIN(A1)
A3 =isnumber(A2) evaluates as FALSE
A4 = istext(A2) evaluates as TRUE

So we have established that DEC2BIN returns text and if we now turn to Excel
help

Remarks

If number1 is nonnumeric, DELTA returns the #VALUE! error value.
If number2 is nonnumeric, DELTA returns the #VALUE! error value.

Yet delta works!! Not very intuative for your students.

Mike

"EvilTony" wrote:

"Jacob Skaria" wrote:

Try

=IF(DELTA(DEC2BIN(A1),B1),"Yes","No")



Thanks.
Thanks to all of you.

As Jakob's "Delta" function is immediately and plainly explained in the Help
pages, that's the one I'll be going with.

My students would not immediately appreciate the use of "text" with a
number, nor the idea of adding something (even a zero) to a number being
checked for correspondence.

Once again, thanks.
--
It''s a little fit bunny, this feeling inside



  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default What 'value' is a Dec2Bin output?

Totally agree with Mike.. Multiplication by 1/Addition of 0 is a commonly
used by programmers in most scripting languages for type casting.

If this post helps click Yes
---------------
Jacob Skaria


"Mike H" wrote:

Hi,

I agree Jacob's solution is very good but multiplication by 1 or the
addition of zero is a commonly used technique in Excel for converting text to
numbers.

If you read Excel help again for Delta I think you still have some
explaining to do to your students. For example

A1=8
A2 =DEC2BIN(A1)
A3 =isnumber(A2) evaluates as FALSE
A4 = istext(A2) evaluates as TRUE

So we have established that DEC2BIN returns text and if we now turn to Excel
help

Remarks

If number1 is nonnumeric, DELTA returns the #VALUE! error value.
If number2 is nonnumeric, DELTA returns the #VALUE! error value.

Yet delta works!! Not very intuative for your students.

Mike

"EvilTony" wrote:

"Jacob Skaria" wrote:

Try

=IF(DELTA(DEC2BIN(A1),B1),"Yes","No")



Thanks.
Thanks to all of you.

As Jakob's "Delta" function is immediately and plainly explained in the Help
pages, that's the one I'll be going with.

My students would not immediately appreciate the use of "text" with a
number, nor the idea of adding something (even a zero) to a number being
checked for correspondence.

Once again, thanks.
--
It''s a little fit bunny, this feeling inside



  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 837
Default What 'value' is a Dec2Bin output?

Put it in quotes; "1000"

If the issue is that it is calculated, then you can coerce it to text, as in
=calc&""

Alternately, you can coerce Dec2Bin(8) to a number, as in
=Dec3Bin(8)+0

Jerry

"EvilTony" wrote:

"Jerry W. Lewis" wrote:

Excel doesn't see them as equal because the number 1000 is not the same as

the character string "1000".

Jerry



I can see that, but how do I stop Ecel seeing the 1000 as a number?
When I format the cell as text the formula still returns a "No", indicating
that the text-string 1000 is not the same as the Dec2Bin(8).

What I am asking for is
A) what format does Excel see a cell as when it holds a Dec2Bin output?
B) how can I make a numerical value equate to a Dec2Bin output?



  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default What 'value' is a Dec2Bin output?

Jacob,,

And the reason I suggested it instead of DELTA is because I have some
difficulty with DELTA because of what I see as inconsistencies. Consider this

A1 to A3 hold the values 2.1, 2.3, 2.4
B1 to b3 hold the values 2.1, 2.4, 2.3

=SUM(A1:A3)=SUM(B1:B3) - Evaluates as we might expect as TRUE

but
=DELTA(SUM(A1:A3),SUM(B1:B3))=1 - Evaluates as FALSE so DELTA doesn't
recognise the 2 sums as equal.

Mike


"Jacob Skaria" wrote:

Totally agree with Mike.. Multiplication by 1/Addition of 0 is a commonly
used by programmers in most scripting languages for type casting.

If this post helps click Yes
---------------
Jacob Skaria


"Mike H" wrote:

Hi,

I agree Jacob's solution is very good but multiplication by 1 or the
addition of zero is a commonly used technique in Excel for converting text to
numbers.

If you read Excel help again for Delta I think you still have some
explaining to do to your students. For example

A1=8
A2 =DEC2BIN(A1)
A3 =isnumber(A2) evaluates as FALSE
A4 = istext(A2) evaluates as TRUE

So we have established that DEC2BIN returns text and if we now turn to Excel
help

Remarks

If number1 is nonnumeric, DELTA returns the #VALUE! error value.
If number2 is nonnumeric, DELTA returns the #VALUE! error value.

Yet delta works!! Not very intuative for your students.

Mike

"EvilTony" wrote:

"Jacob Skaria" wrote:

Try

=IF(DELTA(DEC2BIN(A1),B1),"Yes","No")


Thanks.
Thanks to all of you.

As Jakob's "Delta" function is immediately and plainly explained in the Help
pages, that's the one I'll be going with.

My students would not immediately appreciate the use of "text" with a
number, nor the idea of adding something (even a zero) to a number being
checked for correspondence.

Once again, thanks.
--
It''s a little fit bunny, this feeling inside



  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default What 'value' is a Dec2Bin output?

When you work with 2003 make sure to add the Add-In

If this post helps click Yes
---------------
Jacob Skaria


"EvilTony" wrote:

"Jacob Skaria" wrote:

Try

=IF(DELTA(DEC2BIN(A1),B1),"Yes","No")



Thanks.
Thanks to all of you.

As Jakob's "Delta" function is immediately and plainly explained in the Help
pages, that's the one I'll be going with.

My students would not immediately appreciate the use of "text" with a
number, nor the idea of adding something (even a zero) to a number being
checked for correspondence.

Once again, thanks.
--
It''s a little fit bunny, this feeling inside



  #13   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 806
Default What 'value' is a Dec2Bin output?

Hello,

Ok, we can compare them via
DELTA(DEC2BIN(8),1000)
EXACT(DEC2BIN(8),1000)
--DEC2BIN(8)=1000
DEC2BIN(8)=1000&""
but I would prefer one of the later two since its never too early to
learn about type differences and how it should be compared with Excel.

Regards,
Bernd
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
VBA - Function Output Jeff Excel Discussion (Misc queries) 2 March 30th 07 07:53 PM
=Dec2bin can you increase the number bits please WAT Excel Discussion (Misc queries) 0 July 29th 06 01:20 AM
diverting output -az Excel Worksheet Functions 1 February 24th 06 12:53 AM
How to get leading zeros using DEC2BIN scallyte Excel Worksheet Functions 2 December 8th 05 11:52 PM
Base number functions, example DEC2BIN Wayne Boswell via OfficeKB.com Setting up and Configuration of Excel 0 February 24th 05 04:18 AM


All times are GMT +1. The time now is 12:25 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"