ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro Formula for Max value (https://www.excelbanter.com/excel-worksheet-functions/120947-re-macro-formula-max-value.html)

Gary''s Student

Macro Formula for Max value
 
Try:

Sub bee()
Dim r As Range
Set r = Range("A:A")
v = Application.Max(r)

For i = 1 To 8
If v = Cells(i, "A").Value Then
Cells(1, "D").Value = v
Cells(2, "D").Value = Cells(i, "C").Value
End If
Next
End Sub


It get the max value in column A, finds it, and copies the max value and
asociated date to the D column.
--
Gary's Student


"El Bee" wrote:

I'm working with a spreadsheet that tracks the daily orders. I need to find
the maximum orders for any given month and then associate the date that's in
another column. I then need to capture that date and the sales number and
paste them in two other cells.
I can't sort the daily totals so I can't use the vlookup function. It looks
like I can only write a macro and I'm not sure how to do that.

Sample of what I could be working with.

Column a Column b Column c
2,749 11/30/06
2,916 12/01/06
3,055 12/02/06
9,052 12/03/06
4,830 12/04/06
2,308 12/05/06
2,359 12/06/06
4,153 12/07/06

In this sample the number of sales would be 9,052 and the date would be
12/03/06



All times are GMT +1. The time now is 03:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com