.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Regex solution to ID Excel Cell references in an Excel Formula string

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :.NET Framework

Is there a RegEex solution to accomplish the following:

- Assuming Operator Pattern is "[/*^&()=<>,+-]"
- Cell References are pre-fixed Post-fixed by an Operator (including a comma)
- Cell References Start with Alpha Characters without-interruption - by an operator
    then Followed by numerics-without-interruption - by an operator

----------------------FORMULA STRING INPUT----------------| |---OUTPUT---|
                                                                                        Cell    Cell
1) =I82*I83/365*0.11      <  <  <  <  <  <  <  <  <  <  <  < >  I82     I83
2) =IF(H84>H80*0.91,H84,0.91*H80) <  <  <  <  <  <  <  < >&nbs

View Complete Post

More Related Resource Links

Passing Data to a Cell in Excel



I have a webpage that is created in Visual Studio 2008 and programmed in C#.

I have a web form that prompts the user to enter a value into a text box.  For now, I do not have any validation on that field (I will be adding that later).

I need to pass the value that the user has entered to cell C1 of the excel spreadsheet (user_info.xls).

I understand that using excel is not ideal, but unforutnately need to try to make this work with the excel spreadsheet.

I do not have any code for this yet, because I honestly do not know how to begin.

The action of poulating the excel spreadsheet will be intialized from the On Click event of a Submit button.

Any suggestions would be much appreciated.

Thank you in advance for your assistance,


adding Sumif Formula in Excel using C#



I have to add a sumif formula to a cells in excel using C#, everything else works fine except this formula

The problem is in the "=M"  part. the below formula works fine in VB6. How can I use it in C#.

shtInBound.Cells[k, 2] = "=SUMIF(H8:" + strRangeforHr2 + "9,""=M"",H" + i + ":" + strRangeforHr2 + i + ")";



String Data missing start from "+" When Export Data To Excel Using Gridview

Hi,I am exporting data from gridview to excel file.My problem is that for all the string which contain "+", the rest of data begining from it is missing in excel file.For example: PWE-WER+78, when exported it will become PWE-WER.Below is my code.                Response.ClearContent() Response.Buffer = True Response.AddHeader("Content-Disposition", "attachment;filename=" & "ExportedExcel.xls") Response.ContentType = "application/vnd.ms-excel" Response.Charset = "" lobjStringWriter = New StringWriter lobjHtmlWriter = New HtmlTextWriter(lobjStringWriter) dgdResult.RenderControl(lobjHtmlWriter) Response.Write(lobjStringWriter.ToString()) Response.End() I  have search through online but no solution.Does anyone has idea on this?

some of the cell value cant read from Excel

Hi all, Im reading some data from the excel file, using below code objBusy = new BusinessLogic();                string strFileName = FileUpload1.PostedFile.FileName;                string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + strFileName + ";" + "Extended Properties=Excel 8.0;";                OleDbConnection objConn = new OleDbConnection(connectionString);                objConn.Open();                String strConString = "SELECT * FROM [Product1$]";                //where date = CDate('" + DateTime.Today.ToShortDateString() + "')";                OleDbCommand objCmdSelect = new OleDbCommand(strConString, objConn);                // Create new OleDbDataAdapter that is used to bui

Enhance SSAS so that a calculation returns multiple cells at once (Excel fill not a single cell but

I wonder if somebody can help me with the following question. I would like to create an enhancement to SSAS in a way so that one can pass in multiple values, run a calculation and in return retrieves not one but multiple cell results at the same time e.g. retSet = functionABC(inSET) where inSet is somthing like 5 4 3 6 7 3 4 4 AND retSet is 4 6 7 8 9 3 4 4 All my calculated members in MDX return a single value BUT I need to have a calculation that if called returns multiple results (a set) at once and in a way so that Excel will properly pick up on it and consequently fills multiple cells in the Pivot table. Is that possible at all and if so how? I would not mind to write a little CLR assembly to enhance the SSAS but don't know how to pass the results back. Any ideas are highly appreciated. Dirk

Will the old Excel 2007 Datamining Solution Work With SQL 2008 Express?

Or does it need the full version?  Is there a new version of the Datamining add-in for 2008 Thanks Peter

How to change connection string of a pivot table pointing to SSAS 2005 cube using excel 2003?

Hi All,I am not sure if I should have posted this query to Excel 2003 forum. But posting it here as it applies to SSAS 2005 as well.Ok, let me give the background before I tell the actual problem.We have users on ABC domain and the SSAS server is also on ABC domain. Users on this domain can acess the excel pivots by connecting to cube to browse the data. They leave the Userid & password field blank while they setup the connection string and it works fine. Thanks to windows authentication that takes the credentials of user logged in. Let's say I have two users A and B, they login to ABC domain with their own windows ids.  Now when user A creates a excel file having a cube pivot and then sends this file to user B, user B can refresh and modify the same excel file (he can select new measures to pivot, new hierarchies in filters and so on).Now, let's say I have another user, user C. He has excel 2003 installed on his PC and cannot migrate to excel 2007. He is on different domain XYZ but have a valid windows userid on domain ABC. The domain ABC & XYZ can not be setup to have trusted relationship. Now, when user A sends the same excel file to user C. When user C opens the file and try to refresh it or try to modify the pivot by selecting/deselecting any elements, he gets below error prompt:" An error was encountered in the transport layer." and "Errors in the

How to update single cell of excel sheet using oledb connection,

 Friends i got some codes from net  by using that i can update a excel sheet ,but there we have to specify some header fields name in command string like as fallows ,Update [Sheet1$] set ProductName="IBG" where ProductId=5but i want to update a single cell of excel sheet only,let say O12 cell i want to change somedata,how it is possible that i don't know.plz help me out... thanks in advance...  

Reading Excel Spreadsheet from Cell A7

I don't know a lot about SSIS.  I have an excel spreadsheet where cell A1 and A2 have varchar values and B1 and B2 have decimal values.  Rows 3, 4, and 5 are blank.  Row 6 has the header column names and the data itself starts in A7 through F7.  I am not interested in rows 1 through 5.  The data ends in row 44.  Row 45, 46, and 47 are blank and in cell D48 it has the comment End of Report.  I am only interested in loading A7 through F44.  I do not know if the row count could grow or if it always stays at line 44.  Is there a way to tell SSIS to skip the first 5 rows, read the 6th row as the header and to start loading from A7?lcerni

Use Report Action as default drillthrough on a calculated cell in Excel

Hi, I am using SSAS 2008 R2 and Excel 2010. Is there a way to override the default behavior from the cube to force an excel pivot table to perform a report action rather than a drillthrough when I double click a cell that is a calculated member? Currently, I get an error message. Truth be told, I wouldn't mind making all the double clicking in my pivot table cells pop a report for the user since the drillthrough formatting is so primitive, but I really need to know how to do it for the calculated cells. Thanks, James

How to import excel cell value preceding with '00'



        I am trying to import an excel file in SQL Server 2005 through "OPENROWSET" command.But the problem is in excel there is a column with cell values preceding with '0's.e.g. '000987','000008' etc..the excel file has rows more than a lakhs so manually edit each row is absurd. but while I'm trying to import the data its getting values without the preceding '0's....So please suggest me how do I import the data through SQL Server scripting...


error in excel cell with validation



I don't know where to put this question.

I have a problem in excel. Basically, I want to write data in my excel template from my sql server database. The problem is some cells in the excel has some validation where i can only input data that is exist to the pre-defined data in the cell( i dont know how to call this but it simply pop up when i select that particular cell and will show me the data on it). if the data i inputted not exist then the error will pop up. I only want that pop up error to no be displayed and will continue the process. Currently the system works fine except that i need to press the OK button in the pop up error just to proceed. I am building web application using vs 2005.

Can somebody help me?

Insert data into Excel in an exact cell



If I do the following, I can update a cell in Excel from SQL Express 2008 with the data I want:

SET @strsql = 'UPDATE OPENROWSET(''Microsoft.Jet.OLEDB.4.0'', ''Excel 8.0;Database=' + @strFileName + ''',''SELECT * FROM [MySheet]'') SET [' + @Column + ']=''' + @Variable + ''' WHERE RowID=''' + @RowID + ''''

Is there a way to insert a range of data into Excel starting at a specific cell, rather than just updating one specific cell?



Excel 2010 OLAP Pivot Tables - Can a Date Dimension name be used as a Date not String?


Scenario:  Have built a SSAS 2008 cube and am using Excel 2010 pivot tables as the UI to access the data.  The end-users want to be able to treat the Date Dimension name value as an Excel friendly date, mainly to apply custom formats for pivot charts (such as mmm-yy or dd/mmm/yyyy) and to be able to sort ascending and descending.

Problem:  Although the Date dimension attribute is setup with 'mmm-yy' formatted text as the name and a datetime value as the value, Excel refuses to treat the dimension name as a date.  The result being custom formatting is ignored and pivot sorting results in text sorting only (Apr-00, Apr-01 etc).

Investigation:  Have tried several string combinations for dimension attribute name (even using the Excel datevalue numbers) with no success. Have found some earlier blogs which go part of the way in explaining.  It appears that no matter what you set as the name value you are always going to end up with a string label that can't be formatted or sorted in any other way other than text, as indicated by Darren Gosbell answer to a similiar question.

“...When you display a dimension attribute in an Excel pivot table what you are seeing is the name of each member. The name property of

Formula showing in OSSR Excel spreadsheet exported from SharePoint list


I exported a list of SharePoint issues into an Excel workbook (2010).  The workbook seemed to work normally as I added new columns and  formulae until just now.  Now when I add a variance calc formula in a cell I see only the formula.  The formula is in a format like "=([@[Prior Est]]-[@[Actual (3/27)]])" instead of "=(G2-F2)" and nothing I do seems to get it to show the actual value.

Is there some sort of bug in the SharePoint excel exports after so many columns are added, or what?

Check the if SSAS Roles property is used in excel connection string before returning the values



We are using Excel 2007 to connect to SSAS cubes. We have many roles for a user and all having different permission including different VISUAL TOTAL setting. We want to restrict the user so that he cannot see anything if he is not using the ROLES property in the excel connection string.

At the run time I want to know if the user who is using excel has used ROLES property or not.

Any help will be appreciated

Mr myName

Read/Write Excel file with formulas and accessing cell ranges


I need to read and write data to some specific cells in an excel file.
I want to send some values to cells from front end i.e asp.net web page and after calculation from excel the value should be send again to asp.net

Example if cell A1 = 10 Cell B1 = 20 then C1 cell should have value of A1 + B1 i.e 30 should be displayed and this cell C1 value should be fetched and displayed in ASP.NET Page or some front end

Secondly is it possible to use formula and ranges from asp.net

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend