+ Reply to Thread
Results 1 to 10 of 10

Excel 2007 : Conditional Formatting: Replace Text

Hybrid View

  1. #1
    Registered User
    Join Date
    04-15-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    11

    Conditional Formatting: Replace Text

    Hi Guys,

    Did a search on Conditional Formatting, but could not find anything to solve my issse, hence this post. Please Help

    I have a worksheet with alot of different numbers in it, the numbers are sourced via a forumla as per below,
    =(('Sheet1'!A1-'Sheet1'!A2)/'Sheet1'!A2)*123+100

    This formula generally yields a value ranging between 50 and 150.
    I have then setup conditional formatting on the cell to fill in either red, yellow, green based on a value between 50 and 150.
    ie. If less than 100 = Red
    If less than 110 > 100 = Yellow
    If > 110 = Green

    What i would like it to also do is, if the value is less than 50, replace it with 50, and if more than 150 replace with 150.
    Is this possible ?

    Thanks for the help!

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Conditional Formatting: Replace Text

    I'm thinking you can use a double if statement to do this.

    Say your formula is BELOW
    =(('Sheet1'!A1-'Sheet1'!A2)/'Sheet1'!A2)*123+100
    Then you could do an if statement like
    =If(BELOW< 50, 50, If(BELOW> 150, 150, BELOW))
    Replace the above on all your current formulas and it should do the trick.

    hope that helps
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,274

    Re: Conditional Formatting: Replace Text

    You could use:
    =MEDIAN(SLN(Sheet1!A1,Sheet1!A2,Sheet1!A2)*123+100,50,150)
    Remember what the dormouse said
    Feed your head

  4. #4
    Registered User
    Join Date
    04-15-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Conditional Formatting: Replace Text

    Quote Originally Posted by romperstomper View Post
    You could use:
    =MEDIAN(SLN(Sheet1!A1,Sheet1!A2,Sheet1!A2)*123+100,50,150)
    Brilliant, Thanks Works like a charm!

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Conditional Formatting: Replace Text

    Hi,

    I just figured out the =Median(A1,50,150) and realized why it returns 50, A1 or 150 because one of them must be in the middle. That was a breakthrough for me.

    Now what was the SLN in this answer? Why was it part of the answer?

  6. #6
    Registered User
    Join Date
    04-15-2010
    Location
    Sweden
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Conditional Formatting: Replace Text

    Same here Marvin, learnt something new about the Median and how it works.

    Regarding the SLN, SLN is a depreciation formula (straight line)

    SLN has 3 variable, Cost, Residual Value & Periods.
    E.g. Cost= 20,000 Residual Value= 5,000 Periods=5

    formula would be =SLN(Cost, Residual Value, Periods) = SLN(20000, 5000, 5)
    Result = 3,000

    In Effect a pretty basic formula, ie. (20000 - 5000)/5

    For my use i did not use it for depreciation, but to do performance to target calculation.
    ie. Target= 10 Actual= 8

    Therefore, =SLN(8, 10, 10) (repeat the reference for Residual and Periods)

    Hope that post made sense

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Conditional Formatting: Replace Text

    I guess my question is -
    Why did Romper use the SLN at all?
    He suggested
    =MEDIAN(SLN(Sheet1!A1,Sheet1!A2,Sheet1!A2)*123+100,50,150)
    But why wouldn't
    =MEDIAN((Sheet1!A1,Sheet1!A2,Sheet1!A2)*123+100,50,150)
    work?

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,274

    Re: Conditional Formatting: Replace Text

    What do you think this:
    (Sheet1!A1,Sheet1!A2,Sheet1!A2)
    would do?

  9. #9
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Conditional Formatting: Replace Text

    I copied the wrong line from above. I wanted to copy the first formula of:
    =(('Sheet1'!A1-'Sheet1'!A2)/'Sheet1'!A2)*123+100
    So, are you suggesting the above is the same as:
    =SLN((Sheet1!A1,Sheet1!A2,Sheet1!A2) ?

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,274

    Re: Conditional Formatting: Replace Text

    No, I'm suggesting it's the same as:
    =SLN(Sheet1!A1,Sheet1!A2,Sheet1!A2)*123+100

    There's no good reason to use SLN instead but it does the same.

+ 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