+ Reply to Thread
Results 1 to 5 of 5

How to Search in VisibleCell then enter value if meet criterias

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    How to Search in VisibleCell then enter value if meet criterias

    Hi,
    I'm looking a code to do a task as follow (I did a macro recording but it's not working right)

    1. Find the Max value of column F:F; if the value =3 or smaller then Exit Sub
    2. First Filter Column E:E = 0;
    3. Second Filter Column F:F by the 2nd and 3rd largest number from the Max value of this Column F:F
    4. Start Searching in each visible cell in Column F:F => If cell = 3rd largest number AND below cell = 2rd largest number then
    a/ if cell = 3rd largest number AND below cell = 2rd largest number then
    b/ IF TRUE then enter value "0" in column D:D
    c/ IF FALSE then leave BLANK
    d/ The value should be increased by 1 for each next group of patten

    5. Repeat step 3 & 4 but searching for the 3rd and 4th largest number then enter value in the next Column C:C

    6. Repeat step 3 & 4 but searching for the 4th and 5th largest number then enter value in the next Column B:B

    7. Repeat step 3 & 4 but searching for the 5th and 6th largest number then enter value in the next Column A:A

    Please see sample attached for more clarification
    Regards,
    tt3


    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: How to Search in VisibleCell then enter value if meet criterias

    If you want the value of the cell below it would be cell.offset(1) not cell.offset(-1), (-1) would take you up 1, (1) takes you down.

  3. #3
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to Search in VisibleCell then enter value if meet criterias

    Hi,
    Thank you for your correction.
    1/ The my Code still wrong because it's searching in ALL INVISIBLE cell but I need code to search in ALL VISIBLE CELL only. And how about to:

    but the value of next group pattern should be + 1
    Look at pattern at second No. 2 at column F then value at Column D then increased by 1 => 0 + 1 =1 and the next pattern will be 1 + 1 = 2 and so on
    Column D Column E Column F
    0 0 2
    0 0 3
    0 0 3
    0 0 3
    0 0 3
    0 0 3
    1 0 2

    Regards,
    tt3
    Last edited by tuongtu3; 01-26-2019 at 11:05 AM.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: How to Search in VisibleCell then enter value if meet criterias

    I never tested what happens if there are not 5 different numbers, this should get you on the right track though.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to Search in VisibleCell then enter value if meet criterias

    Hi,
    That code work but not exactly of my expectation:

    Your result:
    Your Result
    0 2
    1 0 3
    2 0 3
    3 0 3
    4 0 3
    5 0 3
    0 2
    6 0 3
    7 0 3
    8 0 3
    9 0 3
    10 0 3
    11 0 3
    12 0 3
    13 0 3
    0 2
    14 0 3
    15 0 3
    16 0 3
    17 0 3
    18 0 3



    Should be:

    Should Be
    0 0 2
    0 0 3
    0 0 3
    0 0 3
    0 0 3
    0 0 3
    1 0 2
    1 0 3
    1 0 3
    1 0 3
    1 0 3
    1 0 3
    1 0 3
    1 0 3
    1 0 3
    2 0 2
    2 0 3
    2 0 3
    2 0 3
    2 0 3
    2 0 3

    Should Be.PNG

+ 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. Last occurrence after meet multiple criterias
    By Dahlia in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-13-2018, 06:16 AM
  2. [SOLVED] Macro Find set criterias to a colomn of number, delete the rows that don't meet criterias
    By TAMMY32 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-03-2017, 04:09 PM
  3. Sumproduct of multiple column (same row) that meet multiple criterias
    By dirdjo in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-28-2016, 03:57 AM
  4. Count multiple criterias within a cell that used alt+enter for input
    By jparve3283 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 06-13-2016, 08:27 PM
  5. Conditional Formula that meet 2 criterias
    By zicitron in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-25-2013, 08:58 AM
  6. Replies: 0
    Last Post: 05-05-2013, 05:47 AM
  7. Using vlookup to get a sales volume but need to meet 2 criterias
    By Vinnie Chan in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 11-07-2008, 05:07 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