+ Reply to Thread
Results 1 to 8 of 8

Check If Numbers In Range (Dynamic Range)

  1. #1
    Registered User
    Join Date
    01-28-2021
    Location
    Kedah
    MS-Off Ver
    2016
    Posts
    40

    Check If Numbers In Range (Dynamic Range)

    Hi,

    Visual how the data represent (Row 2 - 17):
    Dynamic range is red line.

    visual dynamic range_3.png

    Sample data:
    Data in Column D and expected result in Column E.
    Explanation in Column G.

    dynamic range_3.xlsb


    Numbers in real data is decimal point, 3,5.
    Total Row vary in each data, minimum 120, up to 330 000 rows.
    Last edited by your; 05-11-2024 at 01:00 PM. Reason: solved

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,197

    Re: Check If Numbers In Range (Dynamic Range)

    Try this in E4:

    =IF(MEDIAN(D4,LOOKUP(2,1/($E$3:E3=""),$D$3:D3),LOOKUP(2,1/($E$3:E3=""),$D$2:D2))=D4,1,"")
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    01-28-2021
    Location
    Kedah
    MS-Off Ver
    2016
    Posts
    40

    Re: Check If Numbers In Range (Dynamic Range)

    Thanks Phuocam for reply.

    It works fast on small data but slow on large data (300k rows)

    p/s : I have found the solution.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,716

    Re: Check If Numbers In Range (Dynamic Range)

    Re: "p/s : I have found the solution."

    It would be oh so nice to show your solution for people that search the web for a solution like you did.
    The inherent weakness of the liberal society: a too rosy view of humanity.

  5. #5
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,545

    Re: Check If Numbers In Range (Dynamic Range)

    Example of solution:
    Please Login or Register  to view this content.
    Artik

  6. #6
    Registered User
    Join Date
    01-28-2021
    Location
    Kedah
    MS-Off Ver
    2016
    Posts
    40

    Re: Check If Numbers In Range (Dynamic Range)

    @jolivanes, Sorry, I found the solution/code while search on Google, edit a few code lines and edit my data layout to make the code work.
    I only have test the code on a few data, I afraid the solution/code is not true/working 100% for others.
    I marked the post "SOLVED" so the experts not look at my post and instead spend their time to look for other post to solve.

    This is the original code:
    Please Login or Register  to view this content.
    I change the code and my data layout to this:
    Please Login or Register  to view this content.

    Edited data layout : temp solution.xlsb

    For the code, I add colum, remove a variable, remove a few line, rename variable,etc...(Not sure if it is correct but the code working as for now)
    For the data, I add column B and C for max and min value from D column to match the 'edited code'.


    @Artik

    Thanks for the code, the code working on Data, attach on first post.
    When I try it on the data that have decimal number, it is not working.
    But when I change the decimal point to integers, the code is working. Example on Sheet3:

    Change decimal number to integer : temp solution 2.xlsb

    My bad for attach data example one first post not in decimal points.
    My thought of attach data example in integers so that it is easier to understand the problem than decimal points.

  7. #7
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,545

    Re: Check If Numbers In Range (Dynamic Range)

    your, all you need to do in my code is to change the declarations of the variables lMin and lMax from type Long to type Double and the code will work as you intended. The code does not require auxiliary columns, only the data in column D.

    Artik

  8. #8
    Registered User
    Join Date
    01-28-2021
    Location
    Kedah
    MS-Off Ver
    2016
    Posts
    40

    Re: Check If Numbers In Range (Dynamic Range)

    Thanks @Artik, the code is working 100%.

+ 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. Check if cell contains a number in a given range of numbers
    By smockpuv in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-31-2022, 02:02 PM
  2. Hiding Dynamic Range of Numbers Using Row Numbers
    By Freek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-27-2021, 01:25 AM
  3. [SOLVED] Value in textbox in userform to check with a dynamic range in module macro
    By flabb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-15-2016, 05:55 AM
  4. [SOLVED] Pricing Check - based on a dynamic date range
    By Deventus in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-08-2014, 10:24 AM
  5. Macro to check range, if false check another range until true, then copy
    By jayers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-12-2009, 04:19 PM
  6. check if any cell in a dynamic range is empty
    By akabraha in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-30-2008, 04:13 PM
  7. Return the row numbers or a dynamic range in VBA
    By Jim in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2005, 12:05 PM

Tags for this Thread

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