How to find the max value of a column in Excel 2007

Answered How to find the max value of a column in Excel 2007

  • Tuesday, May 08, 2012 4:18 AM
     
     

    I Have a Column "Id" in my excell sheet "MAY".

    I want to find the maximum value of that column.

    i am using the query

    Select max(Id) as ID from [MAY$];

    but this query only fetches the max value as 9 where as the maximum value in my column is 13.

    The Format of the column is General.

All Replies

  • Tuesday, May 08, 2012 4:38 AM
     
     
    hi,

    try this one :
    http://www.excelforum.com/excel-programming/748138-sql-max-id-return.html

    Peter Koueik

  • Tuesday, May 08, 2012 5:03 AM
     
     

    link does not work

  • Tuesday, May 08, 2012 5:27 AM
     
      Has Code

    above link  is working fine here is d text of link,

    hi i need to be able to find the value of the maximum ID in a table i have using VBA. played around with a few variations but none of them seem to wok. Generally they return Syntax errors though i have tried a number of suggestions from a buch of sources.


    rst.Open "Select MAX(ID) FROM Package", conn, adOpenDynamic, adLockOptimistic, adCmdText 
      
                Sheets("New Package").Range("B13").CopyFromRecordset rst
                      
                maxi = Range("B13").Value + 1
                
                rst.Close
                
                rst.Open "package", conn, adOpenDynamic, adLockOptimistic, adCmdTable

    Thanks!


    -- Thanks, Amit kala Please remember to click “Mark as Answer” on the post that helps you, & to click “Unmark as Answer” if a marked post does not actually answer your question.

  • Tuesday, May 08, 2012 5:58 AM
     
     Answered Has Code

    above link  is working fine here is d text of link,

    hi i need to be able to find the value of the maximum ID in a table i have using VBA. played around with a few variations but none of them seem to wok. Generally they return Syntax errors though i have tried a number of suggestions from a buch of sources.


    rst.Open "Select MAX(ID) FROM Package", conn, adOpenDynamic, adLockOptimistic, adCmdText 
      
                Sheets("New Package").Range("B13").CopyFromRecordset rst
                      
                maxi = Range("B13").Value + 1
                
                rst.Close
                
                rst.Open "package", conn, adOpenDynamic, adLockOptimistic, adCmdTable

    Thanks!


    -- Thanks, Amit kala Please remember to click “Mark as Answer” on the post that helps you, & to click “Unmark as Answer” if a marked post does not actually answer your question.

    hi there,
    even though this is a C# general forum
    http://www.ozgrid.com/forum/showthread.php?t=53132


    Peter Koueik