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

  • Home
  • SEARCH
  • 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 576107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:00:44+00:00 2026-05-13T14:00:44+00:00

I’m trying to replicate a formula from an Excel worksheet onto an ASP page,

  • 0

I’m trying to replicate a formula from an Excel worksheet onto an ASP page, but having copied the formula over I’m getting different results (in fact an error because the ASP ends up trying to square root a negative number).

Surely Excel handles operator precedence the same as classic ASP?

The formula I’m trying to replicate is a simple “T-Test” (to report on statistical significance – I didn’t create the formula) and works correctly in Excel. In Excel, the cells look like

A2 = 1098
B2 = 183

A4 = 20.4
B4 = 17.49

And cell E4 contains this formula:

=(A4-B4)/SQRT(((($A$2*A4)+($B$2*B4))/($A$2+$B$2))*
(1-((($A$2*A4)+($B$2*B4))/($A$2+$B$2)))*((1/$A$2)+(1/$B$2)))

So, I simply copy/pasted that formula into classic ASP, removed all the $ and changed SQRT to SQR, declared 4 variables A2, B2, A4, B4. That returns an error (invalid procedure call).

If I remove the first part of the formula – (A4-B4)/SQRT – in ASP the code returns -2.41868099141296, yet in Excel it’s returning 0.001019435.

I have tried and tried calculating parts of the formula separately first, and then putting it back together ready to do the SQRT but keep facing the same thing.

Is this just a silly mistake? At one point I was looking into square roots of negative numbers until I tried =SQRT(-9) in Excel

ASP Code I’m using is (I’ve inserted a line break on the first and last line):

A2 = cdbl(1098.0)
A4 = cdbl(20.4)
B2 = cdbl(183.0)
B4 =cdbl(17.49)

' Remove all the $, and (A4-B4)/SQRT part
response.write "<p>Result: " & ((((A2*A4)+(B2*B4))/(A2+B2))*(1-(((A2*A4)+(B2*B4))
/(A2+B2)))*((1/A2)+(1/B2))) & "</p>"`
  • 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-05-13T14:00:44+00:00Added an answer on May 13, 2026 at 2:00 pm

    I’m a dufus.

    In the Excel spreadsheet columns A4 and B4 are formatted as percentage. The actual value in these cells are 0.204 and 0.1749 respectively. The Excel formula does work when copied and pasted (almost) literally into ASP – I just didn’t catch that my inputs were 100x larger than expected.

    The following code works

    A2 = cdbl(1098.0)
    A4 = cdbl(0.204)
    B2 = cdbl(183.0)
    B4 =cdbl(0.1749)
    
    response.write "<p>Result: " & (A4-B4)/SQR((((A2*A4)+(B2*B4))/(A2+B2))*
    (1-(((A2*A4)+(B2*B4))/(A2+B2)))*((1/A2)+(1/B2))) & "</p>"
    

    So now I just need to convert that into a function.

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

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
i want to parse a xhtml file and display in UITableView. what is the
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim

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.