+ Reply to Thread
Results 1 to 3 of 3

VBA To find nearest biggest number and lowest number

  1. #1
    Forum Contributor
    Join Date
    03-13-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    152

    VBA To find nearest biggest number and lowest number

    Hi Team,

    Please kindly look at the attached file.
    I need a VBA code to find the nearest biggest number and nearest lowest number between the data of D2 to H2.

    In the attached file, I have mentioned my required output (Column A and B - blue highlighted)


    I didn't get required VBA code for the post below, so I have posted here again

    http://www.excelforum.com/excel-prog...ml#post3636085


    Thanks
    Attached Files Attached Files

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: VBA To find nearest biggest number and lowest number

    In B6 Cell

    =IFERROR(INDEX($D$2:$H$2,,MATCH(IF(COUNTIF($D$2:$H$2,B5),B5-1,B5),$D$2:$H$2,1)),0)

    In B7 Cell

    =IFERROR(SMALL($D$2:$H$2,COUNTIF($D$2:$H$2,"<="&D6)+1),"-")

    Select B6 and B7 cells and do copy and paste it in B10:B11 & B14:B15


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Contributor
    Join Date
    03-13-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    152

    Re: VBA To find nearest biggest number and lowest number

    Thanks Sixthsense.
    The second formula is not working as I requested. If I enter '100' in B5 then output would be '200' in B7 (nearest biggest number), however currently it shows '100' in B7. Can you please check it and help me to get out of this

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Nearest smallest and biggest number VBA issue
    By gan_xl in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-25-2014, 11:18 AM
  2. Replies: 5
    Last Post: 02-13-2014, 05:37 PM
  3. [SOLVED] To find nearest biggest number
    By gan_xl in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-10-2013, 07:43 AM
  4. To find nearest biggest number
    By gan_xl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-10-2013, 06:49 AM
  5. Find lowest number in groups then lowest overall.
    By swieduwi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-24-2008, 01:00 PM

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