+ Reply to Thread
Results 1 to 7 of 7

Find 0's down a column and replace the Average of adjacent cells

  1. #1
    Registered User
    Join Date
    11-15-2011
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2013
    Posts
    69

    Red face Find 0's down a column and replace the Average of adjacent cells

    I would like to search a column for 0, when found, replace with the Average of the cell above and the cell below. I found a piece of code that will do what I want, but would like to find a way to incorporate that piece of code that does work into a Find and Replace. I don't want to have to loop through every cell.

    Please Login or Register  to view this content.
    The above code works great if I pre-select a cell with a zero, and run this macro. My attempt to place this into a macro that includes the Find and Replace hasn't worked.
    Please Login or Register  to view this content.
    Any Suggestions or ideas of another way, would be helpful.
    Steve

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Find 0's down a column and replace the Average of adjacent cells

    Try this:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Find 0's down a column and replace the Average of adjacent cells

    Try this:

    Replace the zeros with =Memo()

    The Memo function will do the heavy work for you.

    Please Login or Register  to view this content.


    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  4. #4
    Registered User
    Join Date
    11-15-2011
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2013
    Posts
    69

    Re: Find 0's down a column and replace the Average of adjacent cells

    xladept, Thank you very much.
    Your code works but is working on cells with leading zeros. Many of the values in column H are below 1 decimal values with leading zero's, so it is returning some strange results. I need this to only work on cells that only have a single zero, and return values of like kind, single decimal place values.
    Last edited by sdingman; 07-12-2017 at 02:54 PM. Reason: Forgot

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Find 0's down a column and replace the Average of adjacent cells

    Oops

    Please Login or Register  to view this content.
    Last edited by xladept; 07-12-2017 at 03:38 PM. Reason: Replacer not wanted - better version

  6. #6
    Registered User
    Join Date
    11-15-2011
    Location
    St. Louis, MO
    MS-Off Ver
    Excel 2013
    Posts
    69

    Re: Find 0's down a column and replace the Average of adjacent cells

    mehmetcik, Works great, and very, very fast. Thank You
    Steve

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Find 0's down a column and replace the Average of adjacent cells

    You're welcome and thanks for the rep!

    *I modified the code.

+ 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] Average column if adjacent cells are between a specific number range
    By Madtaxi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-20-2017, 08:56 PM
  2. Looping 'find' to find a value and replace a value in an adjacent column
    By Boltsie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-12-2016, 06:54 PM
  3. Macro to find all specific values in column and replace adjacent cell values
    By dblock02 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2013, 06:03 AM
  4. Average range of cells in column if values in adjacent column are equal
    By RyNye in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-09-2012, 10:12 AM
  5. Find and replace based on adjacent cells?
    By Leo328i6 in forum Excel General
    Replies: 3
    Last Post: 03-16-2011, 03:59 AM
  6. Find multiple words and replace the adjacent column with one word
    By ic3cold in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-13-2011, 05:04 PM
  7. Average non-adjacent cells in column
    By raydaw in forum Excel General
    Replies: 1
    Last Post: 05-22-2008, 10:11 AM

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