• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Help creating formula - Seattle Heart Failure Score

Azraeliev

New Member
The Seattle Heart Failure Score is calculated by the following:

Seattle HF Score = (age/10)*ln(1.09) + male*ln(1.089) + (NYHA class)*ln(1.6) + (100/(ejection fraction))*ln(1.03) + (if ischemic etiology)*ln(1.354) + (SBP/10)*ln(0.877) + (diuretic dose)*ln(1.178) + (if using allopurinol)*ln(1.571) + (if using statins)*ln(0.63) + (if using ACE inhibitors) + (if using beta-blockers)*ln(0.66) + (if using angiotensin receptor blockers)*ln(0.85) + (if using K-sparing diuretics)*ln(0.74) + (if using biventricular pacemaker) + (if using implantable cardioverter-defibrillator)*ln(0.73) + (if using biventricular implantable cardioverter-defibrillator)*ln(0.79) + (138 – sodium)*ln(1.05) + (100/(total cholesterol, mg/dL))*ln(2.206) + (hgb score) + ((% lymphocytes)/5)*ln(0.897) + (uric acid, mg/dL)*ln(1.064),

where diuretic dose, mg/kg = (furosemide + 2*torsemide + 26.7*bumetanide + 40*metolazone + 3.2*hydrochlorothiazide)/(weight, kg)


If hemoglobin, g/dL <16 g/dL,

hgb score = (16 – hemoglobin)*ln(1.124)

If hemoglobin, g/dL ≥16 g/dL,

hgb score = (hemoglobin – 16)*ln(1.336)

Note:
  • Lymphocyte values >47% are set to 47%.
  • Uric acid values <3.4 mg/dL are set to 3.4 mg/dL.
  • SBP values >160 mm Hg are set to 160 mm Hg.
  • Sodium values >138 mEq/L are set to 138 mEq/L.

With so many If's for the life of me I cannot come up with a solution to make it work, please can someone help?

Also I have obne other question, I am trying to use the MAGGIC score for Heart Failure which gives a value to a parameter following the Table 1, and returns a score that relates as is the Table 2

How can I formulate a score cell to lookup the value for each parameter, add them up and fetch from table to the corresponding 1 and 5 year mortality and place it in the approppiate cells?

Table 1
1731952968436.png
Table 2
Integer risk score1-year probability of death3-year probability of death
00.0150.039
10.0160.043
20.0180.048
30.0200.052
40.0220.058
50.0240.063
60.0270.070
70.0290.077
80.0320.084
90.0360.092
100.0390.102
110.0430.111
120.0480.122
130.0520.134
140.0580.146
150.0630.160
160.0700.175
170.0770.191
180.0840.209
190.0930.227
200.1020.247
210.1110.269
220.1220.292
230.1340.316
240.1470.342
250.1600.369
260.1750.397
270.1910.427
280.2090.458
290.2270.490
300.2480.523
310.2690.556
320.2920.590
330.3160.625
340.3420.658
350.3690.692
360.3980.725
370.4270.756
380.4580.787
390.4900.815
400.5230.842
410.5570.866
420.5910.889
430.6250.908
440.6590.926
450.6920.941
460.7250.953
470.7570.964
480.7870.973
490.8160.980
500.8420.985
 
I don't think IFs are needed. You either write out a long formula of the sort
Code:
= (age/10)*LN(1.09)
  + (gender="male")*LN(1.089)
  + ischemic*LN(1.354)
  + (SBP/10)*LN(0.877)
  + statins*LN(0.63)
trying not to create errors as you go, or you do a bit of data prep on the worksheet to generate usable arrays
1731960702284.png
Code:
Formula
= age/10
= SIGN(gender="male")
= SIGN(ischemic)
= SBP/10
= SIGN(statins)
with the calculation expressed as an array formula
Code:
= SUM(coef * LN(weight))

The lookup to the final table (Table2) can be done with a simple INDEX formula or XLOOKUP would work for non-integer values.
 
I know I tried to do it that way, but something got screwed along the long formula and there's a difference between my formula and the official calculator on MedCalc.

I used
=((E4/10)*LN(1,09))+(D4*LN(1,089))+(M4*LN(1,6))+((100/N4)*LN(1,03))+(P4*LN(1,354))+(((MÍNIMO(O4;160))/10)*LN(0,877))+(((Q4+(40*R4)+(3,2*S4))/H4)*LN(1,178))+((U4*LN(1,571)))+((V4*LN(0,63)))+W4+((Y4*LN(0,66)))+((X4*LN(0,85)))+((Z4*LN(0,74)))+((SE(AA4=1;1;(SE(AA4=2;(1*LN(0,73));(SE(AA4=3;(1*LN(0,79));0)))))))+((138-MÍNIMO(AB4;138))*LN(1,05))+((100/AC4)*LN(2,206))+(Seattle!B2)+(((MÍNIMO(AE4;47))/5)*LN(0,897))+((MÁXIMO(AF4;3,4))*LN(1,064))

Returning 1.31

1731978430945.png

Where in MedCalc, same values, same units

1731978521993.png

Is there any way I can send the data on my sheet to that online calculator and it returns the value to my specific table?
 
Nevermind, solved it ->
=((E4/10)*LN(1,09))+(D4*LN(1,089))+(M4*LN(1,6))+((100/N4)*LN(1,03))+(P4*LN(1,354))+(((MÍNIMO(O4;160))/10)*LN(0,877))+(((Q4+(40*R4)+(3,2*S4))/H4)*LN(1,178))+((U4*LN(1,571)))+((V4*LN(0,63)))+((W4*LN(0,77)))+((Y4*LN(0,66)))+((X4*LN(0,85)))+((Z4*LN(0,74)))+((SE(AA4=1;1;(SE(AA4=2;(1*LN(0,73));(SE(AA4=3;(1*LN(0,79));0)))))))+((138-MÍNIMO(AB4;138))*LN(1,05))+((100/AC4)*LN(2,206))+(Seattle!B2)+(((MÍNIMO(AE4;47))/5)*LN(0,897))+((MÁXIMO(AF4;3,4))*LN(1,064))

thanks for the other tip too
 
@Azraeliev, I am glad you have succeeded, it must have taken some persistence!
Some observations would be that your formula is made to appear more complicated by the presence of surplus pairs of parentheses. We are separated by our language settings, but I finished up with something more like
Code:
= E4 / 10 * LN(1.09) +
    D4 * LN(1.089) +
    M4 * LN(1.6) +
    100 / N4 * LN(1.03) +
    P4 * LN(1.354) +
    MIN(O4, 160) / 10 * LN(0.877) +
    (Q4 + 40 * R4 + 3.2 * S4) / H4 * LN(1.178) +
    U4 * LN(1.571) +
    V4 * LN(0.63) +
    W4 * LN(0.77) +
    Y4 * LN(0.66) +
    X4 * LN(0.85) +
    Z4 * LN(0.74) +
    IFS(
        AA4 = 1, 1,
        AA4 = 2, LN(0.73),
        AA4 = 3, LN(0.79),
        1,       0
    ) +
    (138 - MIN(AB4, 138)) * LN(1.05) +
    100 / AC4 * LN(2.206) + B2 +
    MAX(AE4, 47) / 5 * LN(0.897) +
    MAX(AF4, 3.4) * LN(1.064)
Alt/Enter is used to separate the lines. I would also tend to use defined names in place of cell references but most users disagree with that practice! Something that may be of interest is the IFS statement that I have used to replace the nested IFs with their multiple parentheses. If you were to try the solution approach that processes each factor individually and then combines them as an array, this logical structure would have to be repeated within both the calculation of the coefficients and of the weights.

The most important thing, though, is do not lose the good work you already have by overwriting it. A formula that works correctly is many times more valuable than one that looks good but does not return correct results!
 
Back
Top