+ Reply to Thread
Results 1 to 15 of 15

If Statement in the Calculated Field section of the Pivot able

  1. #1
    Registered User
    Join Date
    06-13-2013
    Location
    Washington, DC
    MS-Off Ver
    Execel 2010
    Posts
    14

    If Statement in the Calculated Field section of the Pivot able

    To the Excel wizards

    I am trying to create a IF statement which contains a text such "-(I)" in it. The IF STATEMENT will be used in the Calculation Field within the Pivot table. Any suggestion? I am really stumped.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: If Statement in the Calculated Field section of the Pivot able

    Hi and welcome to the forum

    From the sounds of it, you need to use a wild-card...=if("*-(I)*..............

    Cant be more specific without more detail, sorry
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    06-13-2013
    Location
    Washington, DC
    MS-Off Ver
    Execel 2010
    Posts
    14

    Re: If Statement in the Calculated Field section of the Pivot able

    The pivot table contains data such as the example below. What is interesting, all the Locator codes is designated with a (D) (A) or (I). What I am trying to do is to write an IF Statement , which will search for the - (I) in the Locator Code cell, if it is there put the replicate the HOUR value, if not, multiply HOUR value by 2. Is this possible?

    Locator Code 1qtr YTD hour current units YTD unit cost
    ZZ12356 - (I) Asset Costs 2982 3695 436 436 7.69

  4. #4
    Registered User
    Join Date
    06-13-2013
    Location
    Washington, DC
    MS-Off Ver
    Execel 2010
    Posts
    14

    Re: If Statement in the Calculated Field section of the Pivot able

    Locator Code 1qtr YTD hour current units YTD unit cost
    ZZ12356 - (I) Asset Costs 2982 3695 436 436 7.69

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: If Statement in the Calculated Field section of the Pivot able

    Did you try my suggestion of using a wild-card?

    if("*-(I)*",cell_with_hour,cell_with_hour*2)

  6. #6
    Registered User
    Join Date
    06-13-2013
    Location
    Washington, DC
    MS-Off Ver
    Execel 2010
    Posts
    14

    Re: If Statement in the Calculated Field section of the Pivot able

    Yes I did. It did not work. I used following: =IF(A7="*-(I)*",D7,D7*2)

    Are there any other ways to write it?
    Last edited by Kalief; 06-13-2013 at 08:52 PM.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: If Statement in the Calculated Field section of the Pivot able

    As a test, instead of the wild-card, use the who name, just to see if it works

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If Statement in the Calculated Field section of the Pivot able

    Quote Originally Posted by FDibbins View Post
    Did you try my suggestion of using a wild-card?

    if("*-(I)*",cell_with_hour,cell_with_hour*2)
    The IF function doesn't support the use of wildcards.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If Statement in the Calculated Field section of the Pivot able

    Functions that support wildcards:

    AVERAGEIF - Excel 2007 and later
    AVERAGEIFS - Excel 2007 and later
    COUNTIF - all versions of Excel
    COUNTIFS - Excel 2007 and later
    HLOOKUP - all versions of Excel
    MATCH - all versions of Excel
    SEARCH - all versions of Excel
    SUMIF - all versions of Excel
    SUMIFS - Excel 2007 and later
    VLOOKUP - all versions of Excel

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: If Statement in the Calculated Field section of the Pivot able

    Thanks for that Tony

    So change the suggetsion to something like...

    =IF(ISNUMBER(SEARCH("*-(i)*",a7,1)),1,2)

  11. #11
    Registered User
    Join Date
    06-13-2013
    Location
    Washington, DC
    MS-Off Ver
    Execel 2010
    Posts
    14

    Re: If Statement in the Calculated Field section of the Pivot able

    I'll try it. I'll let you know if I was successful.

  12. #12
    Registered User
    Join Date
    06-13-2013
    Location
    Washington, DC
    MS-Off Ver
    Execel 2010
    Posts
    14

    Re: If Statement in the Calculated Field section of the Pivot able

    It did not work. The - (I) is column A. I have the number 3000 in column B. If there is - (I) identifier in the text description in column A, I want 3000 to show up in column C. Otherwise take column B and multiply it by 2 and put it in Column C.

    How do I write that statement? Keep in min the others didn't work.

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: If Statement in the Calculated Field section of the Pivot able

    ths bolded part does work...
    =IF(ISNUMBER(SEARCH("*-(i)*",a7,1)),1,2)

    All you need to do is replace ,1 and ,2 with what you want to see if -(I) is found (,1) or not found (,2)
    =IF(ISNUMBER(SEARCH("*-(i)*",a7,1)),3000,B7*2)

  14. #14
    Registered User
    Join Date
    06-13-2013
    Location
    Washington, DC
    MS-Off Ver
    Execel 2010
    Posts
    14

    Re: If Statement in the Calculated Field section of the Pivot able

    I think I am not doing it right. I up loaded a Word Doc with two screen shots on it. Take a look. I hope you can see it.

  15. #15
    Registered User
    Join Date
    06-13-2013
    Location
    Washington, DC
    MS-Off Ver
    Execel 2010
    Posts
    14

    Re: If Statement in the Calculated Field section of the Pivot able

    HM568950 - (A) Perform functions 20000 FALSE

    my entry =IF(ISNUMBER(SEARCH("*-(I)*",A2,B2)),B2*2)

    Just in case you could not see screen the shots, above is my entry. My result was FALSE. Did I enter it correctly?

+ 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