+ Reply to Thread
Results 1 to 6 of 6

"RIGHT" extracted value not returning correct result within IF statement

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    5

    "RIGHT" extracted value not returning correct result within IF statement

    This is my IF statement:
    =IF(RIGHT(G1)=Holding_Period,SUM(G19:G22),G14)
    h8cuu.png

    And my RIGHT Statement:
    Y6YRd.png

    My Holding_Period name equals 5 and in the screenshot of the IF statement the logical test should be TRUE. I'm not sure why it's not coming out that way... ?

  2. #2
    Valued Forum Contributor Miraun's Avatar
    Join Date
    04-03-2009
    Location
    New England
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    554

    Re: "RIGHT" extracted value not returning correct result within IF statement

    Is Holding Period a named range? I can't tell if you're using the right function properly either based upon what you've attached. Did you also mean to use RIGHT on the Holding_period range?

    We would need a sample workbook with more information to give you a better answer...
    Going for Guru! Click the Star to the bottom left of this post if I helped!

  3. #3
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: "RIGHT" extracted value not returning correct result within IF statement

    Probably because RIGHT returns a string of '5' and your Holding_Period is an integer. Try:
    =IF(--RIGHT(G1)=Holding_Period,SUM(G19:G22),G14)
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  4. #4
    Registered User
    Join Date
    10-24-2012
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: "RIGHT" extracted value not returning correct result within IF statement

    That did it Pauley. I don't understand what the --'s did, could you tell me?
    Thanks a million.

  5. #5
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: "RIGHT" extracted value not returning correct result within IF statement

    If you do a mathematical operator on a text string that CAN be a number, then Excel changes the string to a number. The '--' is a double negation, so it returns the appropriate number. You could have also used '1*' or '0+' but the '--' seems to be the favored method.

  6. #6
    Registered User
    Join Date
    10-24-2012
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: "RIGHT" extracted value not returning correct result within IF statement

    I see. It's similar to a problem I run into with another program I use often that won't calculate inconsistent units. In that case I divide by 1 of the same unit to achieve the calculation. Thanks again.

+ 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