Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Different uses of AND function

Hi!

I have a code from an unknow author which I try to understand, but I
can't! Can you help me guys?

The code is:

Function bitcheck(ival As Integer, ibit As Integer)
bitcheck = 0
If (ival And 2 ^ ibit) 0 Then bitcheck = 1
End Function

But when I change the If statement for this:
If ival 0 and 2 ^ ibit 0 then bitcheck = 1

the function does not give the same answer. Why??

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Different uses of AND function

On 25 Ago, 22:13, Mathieu936 wrote:
Hi!

I have a code from an unknow author which I try to understand, but I
can't! Can you help me guys?

The code is:

Function bitcheck(ival As Integer, ibit As Integer)
* *bitcheck = 0
* *If (ival And 2 ^ ibit) 0 Then bitcheck = 1
End Function


in this code AND is used as binary operator:

debug.print 3 AND 2 ' - 11 and 10 - 10 = 2
debug.print 2 AND 2 ' - 10 and 10 - 10 = 2
debug.print 1 AND 2 ' - 01 and 10 - 00 = 0
debug.print 3 AND 1 ' - 11 and 01 - 01 = 1


* *If ival 0 and 2 ^ ibit 0 then bitcheck = 1


in your code AND is used as logic operator:
debug.print true and true - true
debig.print false and true - false

Bye!
Scossa
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Different uses of AND function

Hey Thanks Scossa!

I would never found it by myself!

Mathieu

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
User Function Question: Collect Condition in Dialog Box - But How toInsert into Function Equation? SteveM Excel Programming 1 January 3rd 08 03:45 PM
copy of excel file not showing formulal/function in the function b oaallam Excel Discussion (Misc queries) 4 September 6th 07 01:20 PM
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Excel - User Defined Function Error: This function takes no argume BruceInCalgary Excel Programming 3 August 23rd 06 08:53 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM


All times are GMT +1. The time now is 08:10 PM.

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

About Us

"It's about Microsoft Excel"