+ Reply to Thread
Results 1 to 8 of 8

Is it possible to ignore instead of deleting?

  1. #1
    Registered User
    Join Date
    04-22-2013
    Location
    Ankara
    MS-Off Ver
    Excel 2007
    Posts
    30

    Question Is it possible to ignore instead of deleting?

    Hi,

    I wonder is there a code that ignores the value in a cell instead of deleting it. When I want to delete the value of cell, I use EstimatedMax.ClearContent. However, sometimes it shoud not be deleted, just the cell should be ignored when comparing range that includes that cell.

    Thanks in advance,
    Oxco

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    11,226

    Re: Is it possible to ignore instead of deleting?

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-22-2013
    Location
    Ankara
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Is it possible to ignore instead of deleting?

    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    11,226

    Re: Is it possible to ignore instead of deleting?

    You must have a rule that determines when a cell shall be ignored, in order to write the "ignore code". We can't code for "... However, sometimes it should not be deleted ...". In other words, what conditions will always be true that cause ignoring?

  5. #5
    Registered User
    Join Date
    04-22-2013
    Location
    Ankara
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Is it possible to ignore instead of deleting?

    Hi, protonLeah,

    That rule lie in following code after ELSE
    Please Login or Register  to view this content.
    Because the EstMax's weight is larger than the capacity, I can not assign EstMax to RealMax. However, after some loop that EstMax can be assigned to RealMax, thus I do not want to delete it.

    For example, in a range the first maximum value is found as 35. The sum of that value's weights (Cells(Row, 9) + Cells(Column, 9)) is larger than the capacity of V1. I ignored the value of 35 and go on the loop. The second maximum value is found as 30 and it's sum of weights is smaller, so it is assigned as RealMax. When the capacity of V1 is filled up, I should begin the assignments of V2. The value of 35 will be needed now. May be, the sum of 35's wieghts is smaller than the capacity of V2.

    I hope I can explain the process of the algorithm.

    Thanks in advance,
    Oxco

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    12,997

    Re: Is it possible to ignore instead of deleting?

    1) You could use the existing algorithm on a copy of the data. That way, when you have found one solution, you can "reset" the problem by recopying the original data into the working range/vector/array.
    2) You could employ a helper column/array that will store some kind of "ignore this value for this loop" toggle. The toggle could be 0/1 or TRUE/FALSE or "yes"/"no" or whatever you find easiest to work with. Then you could enclose your tests and computations inside of another If...then...end if block that is testing the value of the toggle.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    11,226

    Re: Is it possible to ignore instead of deleting?

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data (no confidential or personal info).

    Also, your code uses RealMax, EstMax & Vehicle so they need to be explained.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  8. #8
    Registered User
    Join Date
    04-22-2013
    Location
    Ankara
    MS-Off Ver
    Excel 2007
    Posts
    30

    Question Re: Is it possible to ignore instead of deleting?

    Steps of algorithm

    1- Found 25 as EstMax
    2- 25 is the intersection of 6th row and 4th column. Thus 4th and 6th row of 9th column are going to be summed. (7+5)
    3- If 7+5 < 19 is true, 25 is assigned as RealMax
    4- The new capacity = 19-(7+5)=7
    5- Now, the new max is going to be found. (belongs which node; 4th or 6th)
    6- the max of 4th row is found
    7- the max of 4th column is found
    8- the max of 4th node is found
    9- the max of 6th row is found
    10-the max of 6th column is found
    11- the max of 6th node is found
    12- the new max is found according to the max of 4th node and the max of 6th node
    13- Does the weight of the new max (11) excess the remaining capacity? (11<7 is false)
    *** the new max will be ignored (15)
    the above process will start again from the step of 5.

    21- Does the weight of the new max (9,6) excess the remainin capacity? (6<7 is true)
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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