The following C# formula to calculate the H-Score is often used for IHC slide analysis.
// H-Score Scoring Formula
//
// Inputs:
// x[0] - 3+ Percentage [0..100]
// x[1] - 2+ Percentage [0..100]
// x[2] - 1+ Percentage [0..100]
//
// Output:
// score [0..400]
double score = 0;
double w1 = 2; // weighting for 1+
double w2 = 3; // weighting for 2+
double w3 = 4; // weighting for 3+
score = (x[0] * w3) + (x[1] * w2) + (x[2] * w1);
return score;