+ Reply to Thread
Results 1 to 6 of 6

Using IF function to run calculation when reference cell contains specific text

Hybrid View

  1. #1
    Registered User
    Join Date
    09-20-2012
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    3

    Using IF function to run calculation when reference cell contains specific text

    Hello. I am trying to create a formula using nested IF statements that will run a calculation based upon specific text that is entered into a reference cell. I am getting a #VALUE! error. The formula is currently written as:

    =IF(D4="B",(Q3*(M3/L3+M3)),IF(D4="C",(Q3*(O3/N3+O3)),IF(D4="A",Q4,)))

    Where:

    * D4 will be populated with the letter A, B or C
    * All cells are formatted as "General"
    * All other cells (e.g. L3, M3, N3, O3, Q3) are populated with number values

    Does anyone know how to resolve the value error so that the formula will run the calculations on the condition that a specific letter is entered into the reference cell? Probably overlooking something really obvious. Thanks.

  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
    53,050

    Re: Using IF function to run calculation when reference cell contains specific text

    you dont need the 2nd IF in that formula if you are only evaluating 3 criteria. try it like this...

    =IF(D4="B",(Q3*M3/L3)+M3,IF(D4="C",(Q3*O3/N3)+O3,Q4))
    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
    09-20-2012
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Using IF function to run calculation when reference cell contains specific text

    Hmm, I tried that but am still getting the #VALUE! error. I think that the error is occurring due to the use of text as a criteria for calculating a numeric value because the formula seems to work with A in Q4. The error only occurs when D4 contains B or C.

  4. #4
    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
    53,050

    Re: Using IF function to run calculation when reference cell contains specific text

    upload a sample please.

    the way you have set up your formula does not include any text in the calcs (unless there is text in your data?)

  5. #5
    Forum Expert Kevin UK's Avatar
    Join Date
    12-07-2010
    Location
    Radstock, Somerset
    MS-Off Ver
    365
    Posts
    1,922

    Re: Using IF function to run calculation when reference cell contains specific text

    Hi

    Your not using Q4 to calculate are you! It is only referenced if D4 = "A"

    Formula: copy to clipboard
    =IF(D4="B",Q3*(M3/L3+M3),IF(D4="C",Q3*(O3/N3+O3),Q4))

  6. #6
    Registered User
    Join Date
    09-20-2012
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Using IF function to run calculation when reference cell contains specific text

    I figured it out. It's:

    =IF(D4="A",Q4,IF(D4="B",(Q4*(L4/(L4+M4))),IF(D4="C",(Q4*(N4/(N4+O4))),"")))

    Thanks for the quick replies.

+ 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