+ Reply to Thread
Results 1 to 10 of 10

IFTEXT & SUBSTITUTE in same cell?

  1. #1
    Registered User
    Join Date
    07-27-2012
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2010
    Posts
    32

    IFTEXT & SUBSTITUTE in same cell?

    Hello,

    I've made a route-sorting spreadsheet and I've run into a bit of a problem. I've got the sorting sorted (pun intended!).

    We get a list which I paste in and the spreadsheet sorts the shops on different routes - all okey.

    The list I get the shops are named like this:
    SHOPNAME LOCATION

    Example:
    7/ELEVEN - GARDERMOEN

    What I want it to look like:
    7/11 - GARDERMOEN

    In short I'm looking to shorten the chainname, and I can do that with substitute like this:
    Please Login or Register  to view this content.
    But when there's no text, i get the #VALUE error vode, how do I remove that? Tried with
    Please Login or Register  to view this content.
    Also, I'd like to be able to have 3-4 names shortened..

    Example:
    7/ELEVEN to 7/11
    WALMART to WM
    HOME DEPOT to HD

    How do I get that in the same formula?

    Any help appreciated! :-)
    Last edited by tk240381; 12-14-2012 at 11:32 AM.

  2. #2
    Registered User
    Join Date
    12-11-2012
    Location
    Manchester, UK
    MS-Off Ver
    Excel 365
    Posts
    91

    Re: IFTEXT & SUBSTITUTE in same cell?

    To avoid the error you could wrap your formula is =if(ISERROR)) and say something like =if(iserror(your formula),"",else your formula)

  3. #3
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    522

    Re: IFTEXT & SUBSTITUTE in same cell?

    =if(iserror(substitute(a1;find("7/eleven - ";a1;10;"7/11-"),"",substitute(a1;find("7/eleven - ";a1;10;"7/11-")

  4. #4
    Registered User
    Join Date
    07-27-2012
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: IFTEXT & SUBSTITUTE in same cell?

    Quote Originally Posted by VKS View Post
    =if(iserror(substitute(a1;find("7/eleven - ";a1;10;"7/11-"),"",substitute(a1;find("7/eleven - ";a1;10;"7/11-")
    =HVIS(ERFEIL(ERSTATT(A1;FINN("7/eleven - ";A1;10;"7/11-");"";ERSTATT(A1;FINN("7/eleven - ";A1;10;"7/11-")

    Can't seem to make this work, it says too many arguments in formula..

    It's the norwegian counter-parts of the names in the formula btw. :-)

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: IFTEXT & SUBSTITUTE in same cell?

    I'm not sure why you have FIND in there. You can do it like this:

    =SUBSTITUTE(A1;"7/ELEVEN - ";"7/11-")

    then if there is no match no change is made.

    You can change the other texts by nesting them together, like this:

    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1;"7/ELEVEN - ";"7/11-");"WALMART";"WM");"HOME DEPOT";"HD")

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    07-27-2012
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: IFTEXT & SUBSTITUTE in same cell?

    This is my actual code..

    Please Login or Register  to view this content.
    ERSTATT = SUBSTITUTE

    This only returns #VALUE for me.

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: IFTEXT & SUBSTITUTE in same cell?

    Why have you got ;12 in there? Remove that and see what happens.

    Hope this helps.

    Pete

  8. #8
    Registered User
    Join Date
    07-27-2012
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: IFTEXT & SUBSTITUTE in same cell?

    Then it said I had too few arguments in the formula. it's 12 there because I read on some webpage I needed it to say how many letters was supposed to be replaced. "REMA 1000 - " is 12 letters.

    Still doesn't work when I removed it.. too few arguments in formula.

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: IFTEXT & SUBSTITUTE in same cell?

    ERSTATT is equivalent to the REPLACE function in English - you need to be using BYTT.TU instead of SUBSTITUTE.

    Hope this helps.

    Pete

  10. #10
    Registered User
    Join Date
    07-27-2012
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: IFTEXT & SUBSTITUTE in same cell?

    It had to be translation.. it works now...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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