+ Reply to Thread
Results 1 to 8 of 8

Automatically enter cell value based on the values of two other cells

  1. #1
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Automatically enter cell value based on the values of two other cells

    I am working on blood pressures. I want cell C1 to place either, "Prehypertension","Stage I Hypertension" or, "Stage II Hypertension" depending on the values of cells A1 or B1

    If (A1>=120 AND A1<=139) OR (B1>=80 AND B1<=89) then C1 should equal, "Prehypertension"

    If (A1>=140 AND A1<=159) OR (B1>=90 AND B1<=99) then C1 should equal, "Stage I Hypertension"

    If (A1>=160) OR (B1>=100) then C1 should equal, "Stage II Hypertension"

    If the values do not meet any of this criteria, then C1 should equal, "NORMAL"

    This is what I have written. I have edited it a number of times but have not yet been successfull in getting it right.

    =IF((OR(AND(A2>=120,A2<=139,B2>=80,B2<=89)),"Prehypertension")(OR(AND(A2>=140,A2<=159,B2>=90,B2<=99)),"Stage I Hypertension")(OR(AND(A2>=160,B2>=100)),"Stage II Hypertension"),NORMAL)

    I am using Excel 2007 and I have attached the book with the code.
    Attached Files Attached Files
    Last edited by vamedic11; 01-09-2010 at 11:24 PM.

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Automatically enter cell value based on the values of two other cells

    Hi Check it out
    Please Login or Register  to view this content.
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Automatically enter cell value based on the values of two other cells

    That formula technically works, but I would suggest changing the order. I'm not a doctor, but I would guess that if A1 is in Stage II Hypertension and B1 is just Stage I Hypertension, you'd want to show the more serious stage II.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Re: Automatically enter cell value based on the values of two other cells

    Thank you both! It works just great. How can I make it so that if no data has been entered in the A and B columns, the cell containing the formula remains blank?

    Right now, the C column populates with, "NORMAL" when the reference cells are empty.

  5. #5
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Automatically enter cell value based on the values of two other cells

    Just another If statement: =IF(AND(A1="",B1=""),"",<current formula>)

  6. #6
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Re: Automatically enter cell value based on the values of two other cells

    Quote Originally Posted by darkyam View Post
    Just another If statement: =IF(AND(A1="",B1=""),"",<current formula>)
    Where would this statement go in the existing formula that you provided me above?

  7. #7
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191

    Re: Automatically enter cell value based on the values of two other cells

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Re: Automatically enter cell value based on the values of two other cells

    DOH!!! I left out a comma.

    THANKS darkyam!

+ 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