+ Reply to Thread
Results 1 to 25 of 25

Nested IF functions

Hybrid View

RyanF Nested IF functions 06-16-2009, 08:14 AM
NBVC Re: Nested IF functions 06-16-2009, 08:21 AM
RyanF Re: Nested IF functions 06-16-2009, 08:39 AM
NBVC Re: Nested IF functions 06-16-2009, 08:46 AM
NBVC Re: Nested IF functions 06-16-2009, 08:51 AM
RyanF Re: Nested IF functions 06-16-2009, 09:19 AM
deadlyduck Re: Nested IF functions 06-16-2009, 10:00 AM
RyanF Re: Nested IF functions 06-16-2009, 10:29 AM
tigertiger Re: Nested IF functions 06-16-2009, 10:03 AM
NBVC Re: Nested IF functions 06-16-2009, 10:23 AM
RyanF Re: Nested IF functions 06-16-2009, 10:32 AM
deadlyduck Re: Nested IF functions 06-16-2009, 10:44 AM
NBVC Re: Nested IF functions 06-16-2009, 10:57 AM
deadlyduck Re: Nested IF functions 06-16-2009, 11:02 AM
RyanF Re: Nested IF functions 06-16-2009, 11:04 AM
RyanF Re: Nested IF functions 06-16-2009, 11:02 AM
NBVC Re: Nested IF functions 06-16-2009, 11:17 AM
RyanF Re: Nested IF functions 06-16-2009, 03:14 PM
deadlyduck Re: Nested IF functions 06-16-2009, 06:05 PM
deadlyduck Re: Nested IF functions 06-16-2009, 11:27 AM
RyanF Re: Nested IF functions 06-16-2009, 03:07 PM
tigertiger Re: Nested IF functions 06-16-2009, 11:38 AM
RyanF Re: Nested IF functions 06-16-2009, 03:10 PM
tigertiger Re: Nested IF functions 06-16-2009, 10:20 PM
RyanF Re: Nested IF functions 06-18-2009, 07:21 AM
  1. #1
    Registered User
    Join Date
    06-16-2009
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Nested IF functions

    Quote Originally Posted by deadlyduck View Post
    If you need the formula to work for different drugs or half-life durations the formula would need to be modified to allow for the revised concentration (ie dose/full life). If required, I can do this but as you've got the other formula working it may not be needed.

    The MOD(number, divisor) function calculates the remainder of 'number' when divided by 'divisor' eg MOD(10,4) would be 2.

    The ROW() function tells Excel the number of the row you are currently on. It's a useful way to perform computations based on 'how far down your formula has gone'.

    Hope this helps.

    Please ensure that if you are happy with the answer that you mark your original thread as solved.

    Thanks-will do.


    =IF(ROWS($D$3:D7)<=32,SUM($D$3:D7)/32,IF(MOD(ROW(),2)=1,SUM($D$3:D7)/32-((ROW()-33)/2)*12.5,E8))

    I'm not clear on what you are doing in the green part of the formula.

    I would appreciate a formula I could use similar to this to with adjusted drug life's and amounts, so I don't have to use an "X" to annotate the drug use on a particular day.
    I would like to try have two cells somewhere on the sheet that the drug life and dose can be inputed into that would change the calcs. or use the days.

    Appreciate the help

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Nested IF functions

    Quote Originally Posted by RyanF View Post

    I would appreciate a formula I could use similar to this to with adjusted drug life's and amounts, so I don't have to use an "X" to annotate the drug use on a particular day.
    I would like to try have two cells somewhere on the sheet that the drug life and dose can be inputed into that would change the calcs. or use the days.

    Appreciate the help
    Using my solution.. see attached...

    You can enter a Half-Life in H2 and a Dosage in I2 and then amend formula in E2 to:

    =IF(AND(C2="",MAX($E$2:$E2)=$D$3/2),IF(E2=E1,E2-$D$3/($H$2*2),E2),(SUM(IF(C3="x",D3/($H$2*2),0),E2)))
    and copy down...
    Attached Files Attached Files
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    06-16-2009
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Nested IF functions

    Quote Originally Posted by NBVC View Post
    Using my solution.. see attached...

    You can enter a Half-Life in H2 and a Dosage in I2 and then amend formula in E2 to:

    =IF(AND(C2="",MAX($E$2:$E2)=$D$3/2),IF(E2=E1,E2-$D$3/($H$2*2),E2),(SUM(IF(C3="x",D3/($H$2*2),0),E2)))
    and copy down...
    Thanks-much appreciated. Now just have to figure what the hell you did

  4. #4
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    540

    Re: Nested IF functions

    I've modified my original formula so that you can vary the dose and/or half-life.
    The attached has the various formulae in coloured cells or cells with a red border.
    You only need to enter the half-life data and dose- the other coloured cells should automatically compute without the 'X' marks
    Attached Files Attached Files
    Last edited by deadlyduck; 06-16-2009 at 06:42 PM.
    Excel 365 user. To unblock a downloaded macro-enabled workbook, go to your "Downloads" folder > right click on the workbook name > click 'Properties' > check the 'Unblock' checkbox. You can now open the workbook.

  5. #5
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    540

    Re: Nested IF functions

    In the green part of the formula, I was doing the following:
    1. As your first dose was in row 2 and the full life was 32 days, I knew that the row in which the first dose would expire was going to be in row 33
    2. Therefore, I needed to start deducting the daily concentration of that first dose (and subsequent doses) from row 33 onwards.
    3. Each subsequent dose expired in row 35,37,39 etc
    4. So I used the MOD(row(),2) function to identify whether or not a dose expired
    5. I could then deduct the relevant quantities of doses from the total

    that's the basic idea.

    To facilitate variable strengths and concentrations, I need to use a more generalised formula- I am working on that at the moment but may be a while before I get it sorted. You might need to check back later.

  6. #6
    Registered User
    Join Date
    06-16-2009
    Location
    Pretoria, South Africa
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Nested IF functions

    Quote Originally Posted by deadlyduck View Post
    In the green part of the formula, I was doing the following:
    1. As your first dose was in row 2 and the full life was 32 days, I knew that the row in which the first dose would expire was going to be in row 33
    2. Therefore, I needed to start deducting the daily concentration of that first dose (and subsequent doses) from row 33 onwards.
    3. Each subsequent dose expired in row 35,37,39 etc
    4. So I used the MOD(row(),2) function to identify whether or not a dose expired
    5. I could then deduct the relevant quantities of doses from the total

    that's the basic idea.

    To facilitate variable strengths and concentrations, I need to use a more generalised formula- I am working on that at the moment but may be a while before I get it sorted. You might need to check back later.
    Appreciate it-thanks

+ 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