+ Reply to Thread
Results 1 to 5 of 5

Creating a formula to calculate a number, depending on the data validation status

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    UK
    MS-Off Ver
    2010
    Posts
    3

    Creating a formula to calculate a number, depending on the data validation status

    Hi there, I've been wrestling with this problem all afternoon and not getting anywhere.

    Attached is an e.g. of the spreadsheet that's driving me to bang my head on my desk.

    So referring to the spreadsheet, I am trying to create a formula to work in cells I3-K3. At the moment a static formula is in there. However, I need this formula to return a result against the below variables:

    IF C3 is "inprogress" or "notstarted", to refer to B3. Then calculate B3*F3.
    OR
    IF C3 is "finished" or "cancelled", to refer to D3. Then calculate D3*F3.

    Normally I'm ok with IF formulas, but I think this one, because the calculation is based on a text-based variable, it needs something else...

    Hope that all makes sense?

    Thanks in advance!
    Attached Files Attached Files

  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,929

    Re: Creating a formula to calculate a number, depending on the data validation status

    Hi and welcome to the forum

    If you only have the 4 options to test against (2 at a time), use this...
    =IF(OR(C3="inprogress",C3="notstarted"),B3*F3,D3*F3)

    if you have more than those 2 pairs, then add on to this as needed, the concept should be clear though...
    =IF(OR(C3="inprogress",C3="notstarted"),B3*F3,IF(OR(C4="finished",C4="cancelled"),D3*F3,"whatever else you want to add"))

    I would ask though...is it possible for C3 to be "inproress" and for D3 to be "cancelled"? or any combo of the 4?
    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
    03-19-2013
    Location
    UK
    MS-Off Ver
    2010
    Posts
    3

    Re: Creating a formula to calculate a number, depending on the data validation status

    Hi there, thanks so much for this!

    The final version of the formula is below & it's working brilliantly:

    =IF(OR(C3="inprogress",C3="notstarted",C3="finished",C3="cancelled"),$B3*F3,$D3*F3)

    At the risk of sounding silly, getting this sorted has made my day :-D

  4. #4
    Registered User
    Join Date
    03-19-2013
    Location
    UK
    MS-Off Ver
    2010
    Posts
    3

    Re: Creating a formula to calculate a number, depending on the data validation status

    Ok, new day = fresh eyes!

    The final formula is actually:

    =IF(OR($N5="inprogress",$N5="notstarted"),$L5*Q5,IF(OR($N5="finished",$N5="cancelled"),$O5*Q5))

    Thanks again!

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

    Re: Creating a formula to calculate a number, depending on the data validation status

    Hi Far_Gone

    Try:
    =IF(OR($C3={"inprogress","notstarted"}),$B3*F3,IF(OR($C3={"finished","cancelled"}),$D3*F3,""))
    Regards Kevin


    Merged Cells (They are the work of the devil!!!)

+ 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