+ Reply to Thread
Results 1 to 7 of 7

Conditional Overwrite

  1. #1
    Registered User
    Join Date
    04-10-2020
    Location
    Lebanon
    MS-Off Ver
    2003
    Posts
    11

    Conditional Overwrite

    Hi

    I have column A Which lists positive and negative values that change over time

    I want Column B to record the maximum negative values that had even been recorded in column A historically
    while Column C will record the maximum positive values that had even been recorded in column A historically

    So when negative values in A change, I want to update the negative values in B ONLY if A values break the historical records in B

    and when positive values in A change, I want to update the positive values in C ONLY if A values break the historical records in C

    Is there a way I can copy values from A and:
    Paste to B such that the new values will ONLY overwrite the old values of B if they are NEGATIVE AND LESSER THAN B?
    Paste to C such that the new values will ONLY overwrite the old values of C if they are POSITIVE AND GREATER THAN C?

    Thanks.

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

    Re: Conditional Overwrite

    Why not just use Excel's MIN and MAX functions?


    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced next to "Post Quick Reply" button at the bottom right of the editor box.
    • Scroll down until you see "Manage Attachments",
    • Click the "Choose" button at the upper left (upload from your computer).
    • Select your file, click "open", click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Close the Attachment Manager window.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ensure to disable any Workbook Open/Autorun macros before attaching!
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-10-2020
    Location
    Lebanon
    MS-Off Ver
    2003
    Posts
    11

    Re: Conditional Overwrite

    Because Column A dynamically changes overtime and I want to retrieve the historical record of maximum values of A. Those values will be lost if i dont preserve them staticly in columns B and C. So min and max are not an option.

  4. #4
    Registered User
    Join Date
    04-10-2020
    Location
    Lebanon
    MS-Off Ver
    2003
    Posts
    11

    Re: Conditional Overwrite

    Example:
    Column A________Column B______________Column C
    -1__________________-1
    -2__________________-2
    -3__________________-3
    +1_____________________________________+1
    +2_____________________________________+2
    +3_____________________________________+3


    Overtime, Column A will change and become
    Column A________Column B______________Column C
    -10__________________ -1
    -1 ___________________-2
    -3___________________-3
    +10_____________________________________+1
    +1______________________________________+2
    +30_____________________________________+3

    so I want to copy values of column A and overwrite the values on column B if the value is less than
    and overwrite values on C if the value is greater than, so i want to have

    Column A________Column B______________Column C
    -10__________________-10
    -1___________________-2
    -3___________________-30
    +10_____________________________________+10
    +1______________________________________+2
    +30_____________________________________+30

    Notice that the original value in column B (-2) and column C (+2) was no overwritten because it did not meet the condition.

    How can I do this?
    Last edited by ZaherHabhab; 12-16-2020 at 06:57 AM.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, Suffolk (England), but grew up in Sawley, Derbyshire
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2211 (Windows 11 22H2 64-bit)
    Posts
    65,348

    Re: Conditional Overwrite

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" to anyone who has offered you help in your thread. You can reward them by clicking on * Add Reputation below theur user name on the left, if you wish.


    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.

  6. #6
    Registered User
    Join Date
    04-10-2020
    Location
    Lebanon
    MS-Off Ver
    2003
    Posts
    11

    Re: Conditional Overwrite

    I created a solution by collecting all previous results and maxing them

    I want to delete this thread how to do it

    I found no option how to delete the thread

    thanks

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, Suffolk (England), but grew up in Sawley, Derbyshire
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2211 (Windows 11 22H2 64-bit)
    Posts
    65,348

    Re: Conditional Overwrite

    You can't. Just mark it solved.

    Select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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. [SOLVED] Overwrite the conditional color format to change color in specific cell
    By Jimmy1709 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2019, 09:34 AM
  2. Replies: 4
    Last Post: 01-15-2016, 05:26 PM
  3. VBA colour overwrite conditional formatting
    By kawaitang in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-01-2013, 08:32 AM
  4. [SOLVED] Macro with "save as" --- Need excel to overwrite a file without a prompt to overwrite
    By tsmith1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2012, 10:54 AM
  5. Prevent data cell overwrite but allow blank cell overwrite
    By Squasher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2011, 09:24 AM
  6. Excel 2007 : Paste Overwrite for Conditional Formatting
    By AdAstraGames in forum Excel General
    Replies: 0
    Last Post: 07-03-2009, 02:30 AM
  7. overwrite
    By SP in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2005, 02:06 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