+ Reply to Thread
Results 1 to 8 of 8

Tricky SUBSTITUTE or REPLACE

  1. #1
    Forum Contributor
    Join Date
    08-04-2013
    Location
    Bucharest
    MS-Off Ver
    Office Professional Plus 2019
    Posts
    304

    Tricky SUBSTITUTE or REPLACE

    What's the best way to swap the digits inside each cell of the L column?
    That is, the first digit should be replaced by the second, and the second digit should be replaced by the first.
    2-0 will be 0-2
    2-1 will be 1-2
    3-0 will be 0-3
    3-1 will be 1-3
    3-2 will be 2-3

    EDIT: it think it can be done with IF

    IF(L1="2-0","0-2", and then nested ifs for each case.. so I think I got it solved

    Also on a sidenote, is there any easy way to automatically select the last 30/60 days from the date pickers? They are linked to cells T15 and T28 but if I change the dates in the cells manually I get an error, possibly because of the DATEVALUE in the date selection formula.

    Thanks!
    Attached Files Attached Files
    Last edited by bibu; 03-16-2014 at 01:20 PM.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Tricky SUBSTITUTE or REPLACE

    Hi,

    Perhaps, if both values are single digits:

    =TEXT(SUMPRODUCT(0+MID(L2,{3,1},1),10^{1,0}),"0-0")

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Tricky SUBSTITUTE or REPLACE

    Or =RIGHT(L2) & "-" & LEFT(L2)
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    08-04-2013
    Location
    Bucharest
    MS-Off Ver
    Office Professional Plus 2019
    Posts
    304

    Re: Tricky SUBSTITUTE or REPLACE

    It works, fine. I came up with my own narrow minded solution in the meantime :D
    =IF(L1="2-0","0-2",IF(L1="2-1","1-2",IF(L1="3-0","0-3",IF(L1="3-1","1-3",IF(L1="3-2","2-3","retirement")))))
    Thx

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Tricky SUBSTITUTE or REPLACE

    @shg

    I know. Just trying something different!

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Tricky SUBSTITUTE or REPLACE

    And a fine formula it is! It lacks only some trig functions for perfection. +Rep if you work one in.

  7. #7
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Tricky SUBSTITUTE or REPLACE

    Does this count?

    =TEXT(SUMPRODUCT(DEGREES(RADIANS(0+MID(L2,{3,1},1))),10^{1,0}),"0-0")

  8. #8
    Forum Contributor
    Join Date
    08-04-2013
    Location
    Bucharest
    MS-Off Ver
    Office Professional Plus 2019
    Posts
    304

    Re: Tricky SUBSTITUTE or REPLACE

    Thanks to both of you. Any idea on the date pickers? I hate using the date picker.

+ 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] substitute/replace until
    By JanRaven in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-02-2012, 12:03 PM
  2. A tricky find and replace
    By arthurArthur in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-16-2011, 10:50 AM
  3. Replace or substitute formula maybe? Not sure what one to use?
    By essexpoker in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-24-2008, 11:25 AM
  4. [SOLVED] [SOLVED] Replace/substitute
    By Viktor Ygdorff in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2006, 09:40 AM
  5. [SOLVED] Substitute/Replace
    By Viktor Ygdorff in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 07-17-2006, 07:40 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