Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Basic question: how do I change these in to functions?

I have a cell that contains the following:
=IF(AC2<11,"A",IF(AC2<16,"B","C"))


How would I convert this into a function?

How about the following?
=OR(AND(AA2=0.333,AA2<=0.458),AND(AA2=0.6666,AA2 <=0.8953))


I think I can figure out the flow of the first one, but I am not sure how to
return the value...
I take it that the cell should have something like
=MyTestFunction()

then the functions should be something like:
Sub function MyTestFunction
if AC2 < 11
returnValue = "A"
elseif
if AC2 <16
returnValue = "B"
else
returnValue = "C"
endif
endif

end sub


TIA,
Phil






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Basic question: how do I change these in to functions?

Public Function Myfunction( rng as Range)
if rng.Value < 11 then
myfunction = "A"
elseif rng.Value < 16 then
myfunction = "B"
else
myFunction = "C"
end if
End Function



=MyFunction(AC2)


"Phillips" wrote in message
news:f8Nub.245493$HS4.2174899@attbi_s01...
I have a cell that contains the following:
=IF(AC2<11,"A",IF(AC2<16,"B","C"))


How would I convert this into a function?

How about the following?
=OR(AND(AA2=0.333,AA2<=0.458),AND(AA2=0.6666,AA2 <=0.8953))


I think I can figure out the flow of the first one, but I am not sure how

to
return the value...
I take it that the cell should have something like
=MyTestFunction()

then the functions should be something like:
Sub function MyTestFunction
if AC2 < 11
returnValue = "A"
elseif
if AC2 <16
returnValue = "B"
else
returnValue = "C"
endif
endif

end sub


TIA,
Phil








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
Visual basic functions Brett Excel Worksheet Functions 2 September 17th 09 12:21 PM
Really basic question! Cell colours change when emailed. De1b0y Excel Discussion (Misc queries) 3 December 17th 07 03:51 AM
Excel n00b, how to do basic math functions Omohundro Excel Worksheet Functions 7 October 29th 07 07:39 PM
Basic excel functions dharmender mehra Excel Worksheet Functions 4 March 19th 07 12:02 AM
Using Basic Excel Functions Novice[_4_] Excel Programming 1 November 8th 03 04:21 PM


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