Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default How to reply a TRUE/False via VBA

How to develop a simple UDF like:
=Correct(Salary,Tax)
so as to return a TRUE if the argument Tax = Salary * 10%?
Thanx!
--
Best Regards,
FARAZ A. QURESHI
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default How to reply a TRUE/False via VBA


Insert a module to the VBA project and use code like:

Function Correct(Salary As Double, Tax As Double) As Boolean
If Abs(Tax - (Salary * 0.1)) < 0.001 Then
Correct = True
Else
Correct = False
End If
End Function

The function considers a difference between Tax and Salary * 10% of
less than 0.001 to mean equal. Due to the intrinsic rounding, it is
likely that the two values may be slightly different when they should,
in fact, be considered equal.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 17 Feb 2009 10:02:11 -0800, FARAZ QURESHI
wrote:

How to develop a simple UDF like:
=Correct(Salary,Tax)
so as to return a TRUE if the argument Tax = Salary * 10%?
Thanx!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default How to reply a TRUE/False via VBA

Function Correct(Salary,Tax)
if Tax = (.1 * Salary ) then
Correct = True
else
Correct = False
end if
End Function

"FARAZ QURESHI" wrote:

How to develop a simple UDF like:
=Correct(Salary,Tax)
so as to return a TRUE if the argument Tax = Salary * 10%?
Thanx!
--
Best Regards,
FARAZ A. QURESHI

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default How to reply a TRUE/False via VBA

Function Correct(Salary As Double, Tax As Double) As Boolean
Correct = Abs(Tax - (Salary * 0.1)) < 0.001
End Function


--
__________________________________
HTH

Bob

"FARAZ QURESHI" wrote in message
...
How to develop a simple UDF like:
=Correct(Salary,Tax)
so as to return a TRUE if the argument Tax = Salary * 10%?
Thanx!
--
Best Regards,
FARAZ A. QURESHI



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
=IF(test,true,false) only ever returns "true"? TagTech Excel Worksheet Functions 5 December 10th 08 03:04 PM
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Excel Discussion (Misc queries) 9 July 29th 08 12:28 AM
Search for 2 true arguments and return true or false David Excel Discussion (Misc queries) 3 July 15th 06 10:18 AM
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM
Reverse false and combine with true true value Emmie99 Excel Worksheet Functions 5 August 17th 05 04:38 PM


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