MassSpecGuru
Board Regular
- Joined
- Feb 23, 2010
- Messages
- 55
Not sure if it's the lack of sleep or what, but try as I might, I can't seem to get my XL formula to function properly.
What I want to do is have a single formula to evaluate the number in a specific cell (the quantitative result of an analytical test) and, depending on the analyte name (up to 5 different ones) in another cell, "code" the result based on whether it is lower or higher than preset (detection) limits. The problem comes in because one analyte, chloride, has detecton limits that are different than (twice as high as) the other four analytes.
In Column A will be the names of the analytes tested. In Column B will be some number, the quantitated concentration of the analyte in Column A. In Column C should be the "corrected" concentration, based on the rules outlined below.
For all analytes other than "chloride", if the quantitative value is less than 50 (ppb), I want the value in the result column, Column C, to be "ND", and conversely, if the quantitative value is greater than 10,000 (ppb) I want the value in the result column to be "OCR" (over calibration range). Otherwise, the value in Column C should be the same as what is in Column B.
For example:
Column A Column B Column C
Nitrate 25 ND
Nitrate 95 95
Nitrate 750 750
Nitrate 11,000 OCR
Nitrate 21,000 OCR
However, if the analyte is "chloride," the "ND" limit should be 100, and if it's over 20,000, then it should be coded "OCR." Anything else should just return the number.
For example:
Column A Column B Column C
Chloride 25 ND
Chloride 95 ND
Chloride 750 750
Chloride 11,000 11,000
Chloride 21,000 OCR
I can write an Excel formula using a couple nested IF statements for each of the analytes alone, but I cannot seem to combine them into one formula that functions properly.
When I use the below formula, everything works fine EXCEPT I get the "over calibration range" error message when Chloride is over 10,000, not 20,000. (Note: In the formula below, I modified the "ND" and "OCR" messages slightly in an effort to see where my formula is falling apart, and like I said, it's when the Chloride is between 10,001 and 20,000.)
=IF(B1<50,"ND1",IF(AND(A1="Chloride",B1>20000),"OCR2",IF(AND(A1="Chloride",B1<100),"ND2",IF(B1>10000,"OCR1",B1))))
Column A Column B Column C
Nitrate 25 ND1
Nitrate 95 95
Nitrate 750 750
Nitrate 11,000 OCR1
Nitrate 21,000 OCR1
Chloride 25 ND1
Chloride 95 ND2
Chloride 750 750
Chloride 11,000 OCR1
Chloride 21,000 OCR2
Sulfate 25 ND1
Sulfate 95 95
Sulfate 750 750
Sulfate 11,000 OCR1
Sulfate 21,000 OCR1
Can anyone help either fix my formula or come up with an entirely different one that works properly?
Thanks a million,
MSG
What I want to do is have a single formula to evaluate the number in a specific cell (the quantitative result of an analytical test) and, depending on the analyte name (up to 5 different ones) in another cell, "code" the result based on whether it is lower or higher than preset (detection) limits. The problem comes in because one analyte, chloride, has detecton limits that are different than (twice as high as) the other four analytes.
In Column A will be the names of the analytes tested. In Column B will be some number, the quantitated concentration of the analyte in Column A. In Column C should be the "corrected" concentration, based on the rules outlined below.
For all analytes other than "chloride", if the quantitative value is less than 50 (ppb), I want the value in the result column, Column C, to be "ND", and conversely, if the quantitative value is greater than 10,000 (ppb) I want the value in the result column to be "OCR" (over calibration range). Otherwise, the value in Column C should be the same as what is in Column B.
For example:
Column A Column B Column C
Nitrate 25 ND
Nitrate 95 95
Nitrate 750 750
Nitrate 11,000 OCR
Nitrate 21,000 OCR
However, if the analyte is "chloride," the "ND" limit should be 100, and if it's over 20,000, then it should be coded "OCR." Anything else should just return the number.
For example:
Column A Column B Column C
Chloride 25 ND
Chloride 95 ND
Chloride 750 750
Chloride 11,000 11,000
Chloride 21,000 OCR
I can write an Excel formula using a couple nested IF statements for each of the analytes alone, but I cannot seem to combine them into one formula that functions properly.
When I use the below formula, everything works fine EXCEPT I get the "over calibration range" error message when Chloride is over 10,000, not 20,000. (Note: In the formula below, I modified the "ND" and "OCR" messages slightly in an effort to see where my formula is falling apart, and like I said, it's when the Chloride is between 10,001 and 20,000.)
=IF(B1<50,"ND1",IF(AND(A1="Chloride",B1>20000),"OCR2",IF(AND(A1="Chloride",B1<100),"ND2",IF(B1>10000,"OCR1",B1))))
Column A Column B Column C
Nitrate 25 ND1
Nitrate 95 95
Nitrate 750 750
Nitrate 11,000 OCR1
Nitrate 21,000 OCR1
Chloride 25 ND1
Chloride 95 ND2
Chloride 750 750
Chloride 11,000 OCR1
Chloride 21,000 OCR2
Sulfate 25 ND1
Sulfate 95 95
Sulfate 750 750
Sulfate 11,000 OCR1
Sulfate 21,000 OCR1
Can anyone help either fix my formula or come up with an entirely different one that works properly?
Thanks a million,
MSG