+ Reply to Thread
Results 1 to 8 of 8

Help with setting a min AND max value within a single cell

  1. #1
    Registered User
    Join Date
    05-24-2012
    Location
    Canada
    MS-Off Ver
    M365
    Posts
    5

    Help with setting a min AND max value within a single cell

    Hello,

    I am having trouble setting a minimum value and a maximum vaule for a single cell.

    For example, I am trying to have a min and max value for the equation A1*B1/C1, where A1 is a user manipulable cell and I want the value displayed restricted to between the set limits.

    Thanks for your help.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Help with setting a min AND max value within a single cell

    Hi and welcome to the forum

    For me, your request, is not clear. Can you give us a better example, or even better to upload a small sample workbook for us?

    Maybe Custom Validation will be the solution...
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    05-24-2012
    Location
    Canada
    MS-Off Ver
    M365
    Posts
    5

    Re: Help with setting a min AND max value within a single cell

    Ok, I have included the line I am trying to work on.

    What I am trying to achieve is the weight can be entered and the Dose(mg) and the Amount(mL) will be generated. The Dose(mg) is done simply. The Amount(mL) column I want to have it limited to minimum 0.1 and maximum 0.5.

    More Indepth. The Weight is multplied by the Recommended dose which gives us the Dose(mg). The Dose(mg) is then divided by the Available Concentration which gives the Amount(mL). There is a minimum amount and a maximum amount of the drug that can be given. I want to set the min and the max so that when the wieght is entered it will not return a value less than the min or more than the max.

    Hope that clairfies things a bit more. Sorry for the confusion.

    Cheers
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: Help with setting a min AND max value within a single cell

    Please get rid of all the merged cells. It makes it nearly impossible to identify a specific cell.

    Also, you do not need a separate column to specify the unit of measure. You can use a custom format to do that. Saves heaps of work.

    I've cleaned up the sheet and assigned range names to make formulas more obvious. I've added two columns for the min and the max values.

    Finally, I've added a formula that returns an error message if the calculated value of Dose divided by Available concentration is not between the min and the max values.

    =IF(OR(Dose/AvConcentration<min,Dose/AvConcentration>max),"not valid",Dose/AvConcentration)

    Have a look at the attached file.

    This is a starting point. We can work on this to fine tune it to your needs.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-24-2012
    Location
    Canada
    MS-Off Ver
    M365
    Posts
    5

    Re: Help with setting a min AND max value within a single cell

    Thanks.

    I need it to return an actual value. If the value is below the min (0.1) then I need it to return 0.1 for the value. Same if the value is above 0.5 and if the value is between 0.1 and 0.5 I need it to give the actual value (Say 0.23, for example)

    Thanks for your time.

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Help with setting a min AND max value within a single cell

    Try

    =MEDIAN(A1*B1/C1,0.1,0.5)

  7. #7
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: Help with setting a min AND max value within a single cell

    Use this formula in cell E5 of the workbook I attached above

    =IF(Dose/AvConcentration<min,min,IF(Dose/AvConcentration>max,max,Dose/AvConcentration))

  8. #8
    Registered User
    Join Date
    05-24-2012
    Location
    Canada
    MS-Off Ver
    M365
    Posts
    5

    Re: Help with setting a min AND max value within a single cell

    Thanks for all the help. npamccp's solution worked perfectly.

+ 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