+ Reply to Thread
Results 1 to 5 of 5

Replace IF Formula

  1. #1
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Replace IF Formula

    Hi

    I have built a model which is almost there.

    I just have two exceptions I need to account for using formula if possible.

    I have a P&L (column B:E) and from this it creates a load file to feed another system (columns J:O).

    I also have a helper column which gives me a unique list of account codes, column G.

    In column J (highlighted Red) is where I need help….

    I need the formula amended so if its 110300 then replace it with 110300120 and if its 111301 then replace it with 111300126. These are the only two exceptions.

    What is the best way to achieve this, as clean as possible?

    Paul
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Replace IF Formula

    Since you already have a helper, a second shouldn't be an issue.

    H8, copied down
    Please Login or Register  to view this content.
    ...then change column J reference ranges from column G to column H.

  3. #3
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Replace IF Formula

    You can get rid helper columns B & G altogether. This array formula will give you your current results directly in Column J

    =IFERROR(INDEX($D$8:$D$15, MATCH(0,IF(ISERROR($D$8:$D$15*1),1,COUNTIF($J$7:J7, $D$8:$D$15)), 0)),"")

    Ctrl+Shift+Enter

    You could then use

    =SUBSTITUTE(SUBSTITUTE(J7,"110300","110300120"),"111300","111300126")
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  4. #4
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Replace IF Formula

    Well if he want s to go without any helpers, here's an all-in-one array formula (Ctrl+Shift+Enter) for J8:
    Please Login or Register  to view this content.
    Array enter THEN copy down.

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Replace IF Formula

    Delete the helper columns. Convert the format of column D to GENERAL and convert the text numbers to real numbers using the Yellow diamond which identifies text numbers and prompts to convert to numbers.

    Format column J as GENERAL and enter this formula in J8 and fill down.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

+ 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 where contents a formula so can't be seen by Find and replace.
    By markDuffy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-26-2015, 02:24 PM
  2. Search and Replace Text with a formula and adjacent cell with a formula
    By 1p3261 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-20-2015, 12:14 PM
  3. [SOLVED] Replace formula
    By mukeshbaviskar in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-28-2013, 01:15 PM
  4. [SOLVED] Find and replace part of a formula changes the entire formula
    By geoffrey22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-27-2013, 06:30 AM
  5. Replies: 3
    Last Post: 05-21-2013, 06:02 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