Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.access,microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Finding the biggest number out of 8 variables

Hi All

Does anybody know of an easy way to find out which variable has the highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks


  #2   Report Post  
Posted to microsoft.public.access,microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Finding the biggest number out of 8 variables

There are many solutions.

You could put the values into an array and pass the array to
a QuickSort routine.

The QuickSort algorithm is difficult to understand, but you
really don't need to know how it works. See:

http://vbnet.mvps.org/index.html?cod...qsoverview.htm


Geoff




"Mojo" wrote in message
...
Hi All

Does anybody know of an easy way to find out which
variable has the highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that
the 5th var has
the highest value, how can I chose the appriopriate var
programmatically?

Thanks




  #3   Report Post  
Posted to microsoft.public.access,microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Finding the biggest number out of 8 variables

Without more detail, have a look in the help index for MAX

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mojo" wrote in message
...
Hi All

Does anybody know of an easy way to find out which variable has the
highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks



  #4   Report Post  
Posted to microsoft.public.access,microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Finding the biggest number out of 8 variables

This MaxOfList() function might help:
http://allenbrowne.com/func-09.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mojo" wrote in message
...
Hi All

Does anybody know of an easy way to find out which variable has the
highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks


  #5   Report Post  
Posted to microsoft.public.access,microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Finding the biggest number out of 8 variables

You asked this same question over in one of the compiled VB newsgroups; so,
because this is an Excel newsgroup, I think you need to clarify something
for us. Are you working in Excel? If so, is your question a VBA question? If
so, what are your variable's names? Or do you mean "variables" in a more
general sense, that being cells on a worksheet? I ask this last question
because if you have your posted values in a worksheet, say in cells A1, B1,
through to H1, then you could use the worksheet's MAX function to get your
value... =MAX(A1:H1) for my assumed cells A1 through H1.

--
Rick (MVP - Excel)


"Mojo" wrote in message
...
Hi All

Does anybody know of an easy way to find out which variable has the
highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks





  #6   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.access,microsoft.public.excel
external usenet poster
 
Posts: 100
Default Finding the biggest number out of 8 variables

Hi Mojo,

Try the following:

Sub GetMaxValue()

Dim Vals(1 To 8) As Integer

Vals(1) = 50
Vals(2) = 20
Vals(3) = 80
Vals(4) = 10
Vals(5) = 90
Vals(6) = 70
Vals(7) = 30
Vals(8) = 40

MsgBox Application.Max(Vals)

End Sub
--
A. Ch. Eirinberg


"Mojo" wrote:

Hi All

Does anybody know of an easy way to find out which variable has the highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks



  #7   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.access,microsoft.public.excel
external usenet poster
 
Posts: 120
Default Finding the biggest number out of 8 variables

does this do what you want?
=MAX(A1:H1)
this will return the highest value in the range

--
Hope this is helpful

Pls click the Yes button below if this post provide answer you have asked

Thank You

cheers, francis

Am not a greek but an ordinary user trying to assist another



"Mojo" wrote:

Hi All

Does anybody know of an easy way to find out which variable has the highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks



  #8   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.access,microsoft.public.excel
external usenet poster
 
Posts: 2
Default Finding the biggest number out of 8 variables

I don't think so.

Damon

"Howard31" wrote in message
...
Hi Mojo,

Try the following:

Sub GetMaxValue()

Dim Vals(1 To 8) As Integer

Vals(1) = 50
Vals(2) = 20
Vals(3) = 80
Vals(4) = 10
Vals(5) = 90
Vals(6) = 70
Vals(7) = 30
Vals(8) = 40

MsgBox Application.Max(Vals)

End Sub
--
A. Ch. Eirinberg


"Mojo" wrote:

Hi All

Does anybody know of an easy way to find out which variable has the
highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks





  #9   Report Post  
Posted to microsoft.public.access,microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Finding the biggest number out of 8 variables

Try something like the following air code.

Sub Test()
Highest(Val1, Val2, Val3, Val4, Val5, Val6, Val7,Val8)
End Sub

Function Highest(Var1,Var2,Var3,Var4,Var5,Var6,Var7,Var8)
Highest = Var1
If Var2 Highest then Highest = Var2
If Var3 Highest then Highest = Var3
If Var4 Highest then Highest = Var4
If Var5 Highest then Highest = Var5
If Var6 Highest then Highest = Var6
If Var7 Highest then Highest = Var7
If Var8 Highest then Highest = Var8
End Function

Regards

Kevin

"Mojo" wrote in message
...
Hi All

Does anybody know of an easy way to find out which variable has the
highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks




  #10   Report Post  
Posted to microsoft.public.access,microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Finding the biggest number out of 8 variables

Function Highest(Var1,Var2,Var3,Var4,Var5,Var6,Var7,Var8)

Hi. For this approach, here's a way to have an unspecified number of
inputs:

Function Highest(ParamArray v())
Highest = WorksheetFunction.Max(v)
End Function

Sub TestIt()
Dim x
x = Highest(12, 15, 9, 5)
MsgBox x
End Sub

= = =
Dana DeLouis


kc-mass wrote:
Try something like the following air code.

Sub Test()
Highest(Val1, Val2, Val3, Val4, Val5, Val6, Val7,Val8)
End Sub

Function Highest(Var1,Var2,Var3,Var4,Var5,Var6,Var7,Var8)
Highest = Var1
If Var2 Highest then Highest = Var2
If Var3 Highest then Highest = Var3
If Var4 Highest then Highest = Var4
If Var5 Highest then Highest = Var5
If Var6 Highest then Highest = Var6
If Var7 Highest then Highest = Var7
If Var8 Highest then Highest = Var8
End Function

Regards

Kevin

"Mojo" wrote in message
...
Hi All

Does anybody know of an easy way to find out which variable has the
highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks






  #11   Report Post  
Posted to microsoft.public.access,microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 199
Default Finding the biggest number out of 8 variables

If you don't make it more clear what you want to do, no one can answer
your question appropriately. Do you want to know the highest value among
some valuables or want to know the variable's name which has the highest
value among some valuables? if what you want is the latter, i think
there is no easy way to know the variable's name or i wonder there is
such a way to know the name. i mean variable's name, not the address of
the variable.

Keiji

Mojo wrote:
Hi All

Does anybody know of an easy way to find out which variable has the highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks


  #12   Report Post  
Posted to microsoft.public.access,microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Finding the biggest number out of 8 variables

=max(your cell range)

Dennis

"Mojo" wrote in message
...
Hi All

Does anybody know of an easy way to find out which variable has the
highest
value out of 8 variables?

For example, I have these values in 8 vars:

3 0 7 30 37 17 0 7

Although from a human's perspective it's easy to see that the 5th var has
the highest value, how can I chose the appriopriate var programmatically?

Thanks


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
Biggest Loser Formula JSR929 Excel Discussion (Misc queries) 8 January 22nd 08 07:40 PM
Finding state that contains employees biggest sale Richard Excel Discussion (Misc queries) 7 July 25th 07 01:14 PM
Finding a name with biggest number Handyy Excel Worksheet Functions 11 February 6th 06 12:06 PM
How do I add the number of variables? emaufmuth Excel Discussion (Misc queries) 1 August 8th 05 09:19 PM


All times are GMT +1. The time now is 02:34 AM.

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"