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 3230424
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:55:32+00:00 2026-05-17T16:55:32+00:00

Everywhere I look for how to use excel function inside of a C# application

  • 0

Everywhere I look for how to use excel function inside of a C# application tells me to do the following:

  • From the COM TabAdd the following using statement:using IExcel = Microsoft.Office.Interop.Excel
  • Then declare and initialise a IWorkSheetFunction objectIExcel.IWorksheetFunction iwf = new IExcel.IWorksheetFunction();
  • Now you can use the functions as in int result = iwf.Math.Sum(1,2);

The problem im having is that while intellisense is detecting IExcel, it is not showing IWorksheetFunction. It is however showing WorksheetFunction. Either way, it is not letting me instantiate it as an object. I am getting the error: Cannot create an instance of the abstract class or interface ‘Microsoft.Office.Interop.Excel.WorksheetFunction’

any ideas?

  • 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-17T16:55:32+00:00Added an answer on May 17, 2026 at 4:55 pm

    Try:

    Microsoft.Office.Interop.Excel.Application xl = new Microsoft.Office.Interop.Excel.Application();
    
    Microsoft.Office.Interop.Excel.WorksheetFunction wsf = xl.WorksheetFunction;
    int result = wsf.Percentile(obj, 0.75);
    

    Basically it comes down to, instead of:

    IExcel.IWorksheetFunction iwf = 
           new IExcel.IWorksheetFunction(); // You can't instantiate an interface
    

    use the WorksheetFunction property in Excel.Application:

    IExcel.IWorksheetFunction iwf = xl.WorksheetFunction;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm starting to see Contexts everywhere I look. In ASP.NET MVC, there are ControllerContexts,
I'm using the stub technique to update my POCO's (used in a detached context,
[Python 3.1] I'm following up on this answer : class prettyfloat(float): def __repr__(self): return
This is a beginner question, but it's been frustrating me... I am using C#,
How do I make this a select statement? This is for Microsoft access. I
I've written a new Visual Studio language service for my software studio's internal scripting
In my other (unrelated) question , @Meleak had SnapsToDevicePixels scattered throughout the code (in
PHP's __autoload() ( documentation ) is pretty interesting to me. Here's how it works:
In my game I want to save a set of integers as statistics players

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.