Merj8
Merj8

Reputation: 13

Writing IF, AND, OR together

I'm new to excel. Trying to create formulas for Lab values obtained in a clinical trial.

For Example: SCr value for Male subjects must be >=1.5 but <=3.5. So I enter my lab values in Visit1 sheet, and then have queries populate in another sheet to discuss with Physicians.

I wrote a formula as follows based on previous posts on this site:

=IF(AND(Visit1!F26>=1.5, Visit1!F26<=3.5, Visit1!D6=Codes!G3), "", "SCr value out of range"

The formula works but I would like to have the message "Please confirm why the SCr value was not obtained" if I enter "Not Obtained" in Visit1!F26 instead of "SCr value out of Range"

p.s. I have things like gender, and "Not obtained" in my Codes! sheet as drop downs.

Please let me know if you need further clarification on my question, thanks,

Upvotes: 1

Views: 59

Answers (1)

Vityata
Vityata

Reputation: 43595

Actually, when you work with nested ifs and longer formulas, it is probably a best practice to put spaces between the different segements.

Like the formula in your case: =IF(Visit1!F26="Not Obtained","Please confirm why the SCr value was not obtained",IF(AND(Visit1!F26>=1.5, Visit1!F26<=3.5, Visit1!D6=Codes!G3), "", "SCr value out of range"))

Can become:

enter image description here

Press Alt+Enter to get the new line.

Upvotes: 3

Related Questions