Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formula in Excel - Logarithmic Average

I need to implement this equation:

Logarithmic Sum

In c# it is pretty straightforward:

static double LogarithmicSummed(IReadOnlyList<double> values)
{
    double outVal = 0;
    for (int i = 0; i < values.Count; i++)
    {
        outVal = outVal + Math.Pow(10, values[i] / 10);
    }
    return 10 * Math.Log10(outVal);
} 

I need to verify the data in an excel sheet where I print out the data programmatically. That is the raw data, my c# calculations on the raw data AND the excel formual that should match my c# calculations. I just do not know how to write the formula in excel.

I know the rows and columns where the data are and they are next to each other. So for example, if I needed the arithmetic average, ie:

Arithmetic average

I could print out for each row:

// If row = 1, startColumn = A, endColumn = D, noOfColumn = 4. This would print: =SUM(A1:D1)/4
mean[row] = @"=SUM(" + startColumn + row + ":" + endColumn + row + ")/" + noOfColumns;

What would I print out to match the first formula I wrote? Or what would I need to write in Excel?

like image 731
Daltons Avatar asked Feb 26 '26 00:02

Daltons


1 Answers

without VBA:

Put your data in A1 through A10 and in B1 enter:

=10^(A1/10)

and copy down. Then in another cell enter:

=10*LOG10(SUM(B1:B10))

enter image description here

You can avoid the "helper" column (column B) by using:

=10*LOG10(SUMPRODUCT(10^((A1:A10)/10)))
like image 152
Gary's Student Avatar answered Feb 28 '26 12:02

Gary's Student



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!