Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8852653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:27:20+00:00 2026-06-14T13:27:20+00:00

I have a excel formula I am trying to translate into c# code. It

  • 0

I have a excel formula I am trying to “translate” into c# code.

It is used to calculate an “annuity rate” over time (for example 20 years).

=(((1+E26/100)^D28*((1+E26/100)-1))/((1+E26/100)^D28-1))*100

D28 = 20 (years)

E26 = 5,00 (the rate in percent)

the ^ stands for exponent in Excel

As a result with these numbers I expect 8,02% per annum.

I tried several approaches using Math.Pow but wasn’t successful.

Here is my first approach which gives me a result of 5 somehow.

double usagePanels = 20.0
double rate = 5.0
annPanels = (Math.Pow((1 + rate / 100), usagePanels) *
           ((1 + rate / 100) - 1) /
           Math.Pow(1+rate/100, (usagePanels-1))) * 100;

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:27:21+00:00Added an answer on June 14, 2026 at 1:27 pm

    Try:

    double usagePanels = 20.0
    double rate = 5.0
    double annPanels = (Math.Pow((1 + rate / 100), usagePanels) *
             (rate / 100.0)) /
             Math.Pow(1+rate/100, usagePanels)-1)) * 100;
    

    You’ve got the closing bracket, between usagePanels and the -1, wrong…

    (I found this by breaking the formula apart in Excel and in C# and comparing each part.)

    EDIT: Another handy tip for comparing Excel to C# is to give the cells in Excel a name (via the Named Range feature) that way the Excel formula can be made to look closer to variable names…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

VBA newbie over here. I'm trying to use an array formula through excel vba
i have a c# code which gets the (excel-2007) worksheets used range as follows
I have been trying to use a formula that is used to work out
I'm trying to convert some Excel formulas into C# code, and I'm kind of
is there a way in Excel to have a formula that does something like
I have a formula like this which works fine on Excel/OOCalc applications: =SUMPRODUCT(--($Panels.$A$5:$A$6999=K$80);--($Panels.$B$5:$B$6999=K$81);INDEX($Panels.$C$5:$J$6999;0;MATCH(Voc;$Panels.$C$3:$J$3;0))) Since
G'day, I have never really used excel formulas before but need to convert a
I have an excel csv with a date/time column and a value associated with
I am trying to display milliseconds in an Excel macro. I have a column
I have an excel sheet and was trying to figure out if there was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.