+ Reply to Thread
Results 1 to 8 of 8

Convert joined text strings into a formula

  1. #1
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Convert joined text strings into a formula

    I’m using a formula to pull real-time data into Excel for the probability of an event. I want to calculate the probability of the event NOT occurring using 1-[Probability of Occurrence]. The Probability of Occurrence is a long formula and I know I could build it like this:

    =if(sign(D6)=1, 1-Probability of Occurrence formula, Probability of Occurrence formula)

    But since Probability formula is long and complex, I wondered if I could simplify it something like this instead:

    =if(sign(D6)=1, “1-“,”1*”) Probability of Occurrence formula result

    But either I cannot find the right operators, syntax or it’s not possible. Anyone know the answer / know the solution?

    Thanks, I appreciate any suggestions.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,698

    Re: Convert joined text strings into a formula

    Try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where P is Probability of Occurrence formula result
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Convert joined text strings into a formula

    Perfect! I could have simplified a lot of formulas in the past if I'd have simply thought to ask that question! Thanks for the speedy reply too!

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,698

    Re: Convert joined text strings into a formula

    Glad to help and thanks for the rep!

    On second look it really should be

    =IF(SIGN(D6)=1,1,0) - SIGN(D6)*P

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,463

    Re: Convert joined text strings into a formula

    Quote Originally Posted by 6StringJazzer View Post
    =IF(SIGN(D6)=1,1,0) - SIGN(D6)*P
    Another way to write this...

    =MAX(SIGN(D6),0)-SIGN(D6)*P

    However, if I am not mistaken, this alternate formula should produce the same results...

    =CHOOSE(SIGN(D6)+2,P,0,1-P)
    Last edited by Rick Rothstein; 10-06-2019 at 12:13 AM.

  6. #6
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Convert joined text strings into a formula

    6StringJazzer/Rick,

    Thanks for the additional suggestions – all work as desired.

    Rick – just out of curiosity, is there a way to rewrite the “Choose” version that doesn’t required “P” to be entered twice? That’s was what I was trying to avoid since I wanted to shorten/simply the formula. The following are the formulas with the “P” replaced with the actual formulas which hopefully will make it clearer.

    “One P”
    =IF(SIGN(D6)=1,1,0) -SIGN(D6)*RTD("tos.rtd",,R$5,RIGHT($AC6,LEN($AC6)-IF(OR(LEN($AC6)<8,LEFT($B6,1)="/"),2,1)))

    Or

    =MAX(SIGN(D6),0) -SIGN(D6)*RTD("tos.rtd",,R$5,RIGHT($AC6,LEN($AC6)-IF(OR(LEN($AC6)<8,LEFT($B6,1)="/"),2,1)))

    “Two Ps”
    =CHOOSE(SIGN(D6)+2,RTD("tos.rtd",,R$5,RIGHT($AC6,LEN($AC6)-IF(OR(LEN($AC6)<8,LEFT($B6,1)="/"),2,1))),0,1-RTD("tos.rtd",,R$5,RIGHT($AC6,LEN($AC6)-IF(OR(LEN($AC6)<8,LEFT($B6,1)="/"),2,1))))

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,463

    Re: Convert joined text strings into a formula

    Quote Originally Posted by aquixano View Post
    Rick – just out of curiosity, is there a way to rewrite the “Choose” version that doesn’t required “P” to be entered twice?
    No, but you could put your formula in a cell and then reference that cell instead. Let's say you put the formula in cell X6, then my formula would become this...

    =CHOOSE(SIGN(D6)+2,X6,0,1-X6)

    If that is not an option, then you should use 6StringJazzer's code, either as he originally posted it or with the minor modification I posted for it.
    Last edited by Rick Rothstein; 10-06-2019 at 10:11 AM.

  8. #8
    Forum Contributor
    Join Date
    09-21-2014
    Location
    Midwest USA
    MS-Off Ver
    2010
    Posts
    349

    Re: Convert joined text strings into a formula

    Thank you.

+ 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. Convert shorthand time text strings into full sentences
    By amit2385 in forum Excel General
    Replies: 3
    Last Post: 10-16-2018, 05:57 PM
  2. [SOLVED] Convert Numbers to Strings - Need Formula
    By Alan3285 in forum Excel General
    Replies: 8
    Last Post: 03-12-2015, 11:31 PM
  3. Formula to find and return text string within a cell full of text strings
    By LightingPop in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-03-2013, 11:45 PM
  4. Replies: 2
    Last Post: 03-07-2013, 02:34 AM
  5. Replies: 3
    Last Post: 01-31-2012, 12:40 PM
  6. Convert ASCII Character strings into HEX Strings
    By Chris Mathers in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-13-2010, 12:25 PM
  7. Convert text strings to a code or number
    By MaxNY23 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 03-23-2006, 06:50 PM

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