Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable Manipulation
Im assigning cell contents to variables;
Mid = Range("A9").Value Nor = Range("C9").Value Uni = Range("E9").Value While this procedure is running I need to sort those three variables low to high then run a series of nested if statements. I do not know how to sort the variables assigning a ranking to be used in the nested ifs. Any advise welcome€¦ Appreciatively, Arturo |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable Manipulation
Arturo,
How about this to put them into ascending order Dim ary(1 To 3) Dim temp ary(1) = Range("A9").Value ary(2) = Range("C9").Value ary(3) = Range("E9").Value If ary(1) ary(2) Then temp = ary(2) ary(2) = ary(1) ary(1) = temp End If If ary(2) ary(3) Then temp = ary(3) ary(3) = ary(2) ary(2) = temp If ary(1) ary(2) Then temp = ary(2) ary(2) = ary(1) ary(1) = temp End If End If You can then use it's index as the rank -- HTH RP (remove nothere from the email address if mailing direct) "Arturo" wrote in message ... I'm assigning cell contents to variables; Mid = Range("A9").Value Nor = Range("C9").Value Uni = Range("E9").Value While this procedure is running I need to sort those three variables low to high then run a series of nested if statements. I do not know how to sort the variables assigning a ranking to be used in the nested ifs. Any advise welcome. Appreciatively, Arturo |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable Manipulation
First of all do not use variable name Mid cause it conflicts with
function 'Mid' use variable names iNor iMid iUni. Then decide what will you do if two of the variables are equal or if all three are equal. Assuming that none will be equal you can use code like following. If iNor iMid And iNor iUni Then 'your code to run if iNor is highest End if If iMid iNor And iMid iUni Then 'your code to run if iMid is highest End if If iUni iNor And iUni iMid Then 'your code to run if iUni is highest End if However you can reduce the number of statements, also run with other conditions. If you can post exact conditions you want to satisfy, it will help. Sharad *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Value manipulation | Excel Discussion (Misc queries) | |||
Data Manipulation. | Excel Discussion (Misc queries) | |||
Text manipulation | Excel Worksheet Functions | |||
string manipulation | Excel Programming | |||
string manipulation | Excel Programming |