+ Reply to Thread
Results 1 to 4 of 4

Need to find/replace a certain instance of number within column of formula.

  1. #1
    Registered User
    Join Date
    10-07-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    2

    Need to find/replace a certain instance of number within column of formula.

    Hi all

    This is my first post on this forum so apologies if it is not in the correct place or has been answered but I could not find a solution.

    I use a piece of software at work that outputs data into an excel spreadsheet. Usually at the end of a job I spend a few hours reformatting the spreadsheet so decided to set up some simple recorded macros (not able to write them myself) to speed the process. Most of these are fairly straight forward but I am stuck on this one.

    The original output shows results that haven't been run as -1 or -2 depending on the section so I have used a simple find and replace macro to replace them all with n/a as seen in the example. This however affects the functions that use info from those cells. I would therefore like to be able to use find and replace to edit a certain part of those functions. For this example I will refer to columns F, H & I. Please also note that the top two rows contain formula that I have amended to suit our own needs.

    So take rows 10 & 11 as the example, F10 has been changed from -1 to n/a which has affected the formula in F10/11 which reads =IF((F10=0), 0, F11/F10) (please note at this point that instances of 0 should show -1 for the formula to truly work but does not), I would like to use find and replace to change this to =IF((F10="n/a"), "n/a", F11/F10) but my limited knowledge efforts have returned similar but also the 0 in F10 has been replaced. So the question (bet you thought I'd never get there) would be is it possible to specify certain instances of 0 within the formula to change to n/a without affecting the instances in the F10's or to have it replace any of the cells within the searched column that contain a formula (there are blank rows that will vary in position and frequency from project to project) with the formula stated in H1/2 but obviously using the data from the corresponding rows?

    Hope that makes sense and isn't too long winded.

    I am aware that most of you would find this childs play in terms of writing VBA macros but please bear in mind that when I read said macros it is the equvilant of a pig reading latin and I would hope to use the results in a similar manner for different aspects of the spreadsheet .

    Many thanks in advance

    Steve
    Attached Files Attached Files

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Need to find/replace a certain instance of number within column of formula.

    Hello Stevehatesexcel,

    Welcome to the Forum.

    Please see if the Formulae in the cells highlighted in yellow, as per the attached Workbook, will work for you.

    Thank you
    Attached Files Attached Files
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Registered User
    Join Date
    10-07-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Need to find/replace a certain instance of number within column of formula.

    Hi Winon

    Thanks for your quick reply but I feel I may not have explained the question clearly. The problem I have is using the find/replace tool (or a macro) to ammend all of the formula within column H so that I do not have to do them all individually as each job could contain upto 2000 results in this column alone and there are many different sheets with variations of the same issue. The formula I wish to replace them with is shown on Cells (H1:H2) but references Cells F1 & F2 and reads as =IF((F1="n/a"),"n/a",F2/F1). So I would like to be able to search for and replace all instances of the existing formula in column H with this formula but have it reference the corresponding info in column F e.g Cells H22:H23 contain the formula =IF((F22="n/a"),"n/a",F23/F22).

    Again thanks for taking time to reply.

    Best

    Steve

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Need to find/replace a certain instance of number within column of formula.

    Hello Stevehatesexcel,

    Thank you for the feedback.

    With my sample formulae in yellow, as per the sample Workbook, it also returns "n/a", plus if referencing cells happen to be empty, or have a zero value, it does not return any errors like, DIV/0! or #VALUE!, while your formula does not cater for such an occurrence.

    Further than that, I am afraid you will unfortunately just have to do a Search, Find and Replace, as I do not believe it would be possible to do it with VBA, since you mention that...

    ....have to do them all individually as each job could contain upto 2000 results in this column alone and there are many different sheets with variations of the same issue.
    If you, however, do find a VBA solution, then please do let me know, I would love to see that.

    Best of luck.

+ 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] Find and Replace first instance of word Only
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2013, 01:14 PM
  2. [SOLVED] find and replace for instance
    By nicktater in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2013, 04:42 PM
  3. [SOLVED] Lookup Table to Find/Replace Every Instance of a String (2/2)
    By Baghel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-04-2013, 05:49 AM
  4. Replies: 12
    Last Post: 12-31-2012, 04:13 AM
  5. Find the First Instance of a Number
    By Phillycheese5 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-18-2008, 10:59 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