+ Reply to Thread
Results 1 to 10 of 10

Calculating the Max Number and displaying Msg box

  1. #1
    Registered User
    Join Date
    12-23-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    13

    Calculating the Max Number and displaying Msg box

    I have a random data.
    Now I want to calculate the Person who;s having maximum number of Cars.
    I am trying to write a vba code to do that .
    Attaching is the sample data
    Please help

    Thanks
    Anir
    Attached Files Attached Files

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Calculating the Max Number and displaying Msg box

    Hi Anir,

    Would it not be the count of a name from a column A which is repeated maximum time ?
    Also, what if 3 person are sharing max number of car ?
    In your example, following person have 4 cars each
    Anir
    Raghav
    Rohit

    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Calculating the Max Number and displaying Msg box

    Try this..................:
    Attached Files Attached Files
    Gary's Student

  4. #4
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    872

    Re: Calculating the Max Number and displaying Msg box

    As I see in the file, the names always have a unique number. something like motorracing.
    Please Login or Register  to view this content.
    Harry.

  5. #5
    Registered User
    Join Date
    12-23-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating the Max Number and displaying Msg box

    Hi Dilip,

    Thanks for replying :-)

    Yes it would be something like that but i am not able to write VBA Code around it,
    And in case if more than 1 person is sharing top position then i would like to print all of them

    Thanks
    Anir
    Last edited by anir_sarkar1; 12-30-2012 at 02:07 PM.

  6. #6
    Registered User
    Join Date
    12-23-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating the Max Number and displaying Msg box

    @HSV

    Hi SIr,

    Thanks for putting in efforts :-)

    But this code is giving me result as 'Shifali' but she dont have maximum no. of cars.
    Your code is catching the maximum value from column two and displaying the name against it. However column two is just a Unique Registeration Code for Person.
    However Colume 3 is the name of the Car which that particular person is having

    Thanks
    Anir
    Last edited by anir_sarkar1; 12-30-2012 at 02:12 PM.

  7. #7
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    872

    Re: Calculating the Max Number and displaying Msg box

    Try it once.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-23-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating the Max Number and displaying Msg box

    @HSV

    Hi Sir,

    This is giving me name of the Cars against the Reg. No. 5.
    But i want the person having maximum cars
    Like in attached sheet we have
    Rohit = 4Cars
    Raghav = 4Cars
    Anir = 4Cars
    Shifali = 2Cars
    Sangram = 3Cars

    So i want resule as Raghav anir and Rohit since they are having maximum number of Cars

    Thanks
    Anir
    Last edited by anir_sarkar1; 12-30-2012 at 03:03 PM.

  9. #9
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Calculating the Max Number and displaying Msg box

    How about this code?

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    12-23-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Calculating the Max Number and displaying Msg box

    Thanks Andrew

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1