Re: (newbie) Find Max Number In An Array



"Nektarios - Greece" <eizo5@xxxxxxxxxxxx> schreef in bericht
news:e7rl55$1ks0$1@xxxxxxxxxxxxxxxxxxxxxx
Marco van de Voort wrote:
How? How do you know it is 2.1 and not 2.10004 ?



The X is integer.
The Y is real.
X > 0 and Y > 0.
I use '#.###' number format.
The cells in Excel goes like this

X Y
--------
25 0.571
26 0.555
27 0.534
28 0.530
29 0.535
30 0.541
etc


I already know that the values of Y CANNOT be the same, at different value
of X. Also, the values of Y as you can see are CLEARLY different.

The minimum in the range [25..30] is somewhere around 28. Is it sufficient
to know that or do you need to know it more accurately, like 28.01?

If it is only a matter of finding the nearest integer X for which Y is at
minimum, then just step through the range, like:
determine Xfirst and Xlast: the range in which the minimum must be found.
Xmin:=Xfirst; Ymin:=MyFunction(Xfirst);
for x:=Xfirst+1 to Xlast do
begin Y:=MyFunction(x);
if Y<Ymin then begin Xmin:=x; Ymin:=Y end
end;

If you need it more accurately, then continue with a minimum-search function
(to be found on the web) for a search on the interval Xmin-1..Xmin+1.

Tom


.



Relevant Pages

  • Re: performing calculations on time data
    ... the worksheet and not in vba code. ... the all cells are formatted as general. ... This little test worked for me in Excel 2003... ... When the format was adjusted ...
    (microsoft.public.excel.programming)
  • Re: Numberformat applied but does not change data
    ... Typing in whole numbers Excel decideds that we are ... The format gets applied, but the data is not appearing as expected. ... When i open the Excel workbook, the data is there and those cells ...
    (microsoft.public.excel.programming)
  • RE: Numberformat applied but does not change data
    ... Excel tries ... Typing in whole numbers Excel decideds that we are typing in ... The format gets applied, but the data is not appearing as expected. ... When i open the Excel workbook, the data is there and those cells show it ...
    (microsoft.public.excel.programming)
  • Re: Numberformat applied but does not change data
    ... Typing in whole numbers Excel decideds that we are ... The format gets applied, but the data is not appearing as expected. ... When i open the Excel workbook, the data is there and those cells show ...
    (microsoft.public.excel.programming)
  • RE: Numberformat applied but does not change data
    ... Excel tries ... Typing in whole numbers Excel decideds that we are typing in ... The format gets applied, but the data is not appearing as expected. ... When i open the Excel workbook, the data is there and those cells show it ...
    (microsoft.public.excel.programming)