PHPexcel formula error for complex formula - excel-formula

I'm using PHPExcel to read an excel sheet. This is my code.
$this->excel->setActiveSheetIndex(1);
$data = $this->excel->getActiveSheet()->toArray(null, true, true, true);
But I'm getting this error message.
Fatal error: Uncaught exception 'PHPExcel_Calculation_Exception' with
message 'Individual client details!E4 -> Formula Error: An unexpected
error occured' in
/var/www/html/application/third_party/PHPExcel/Cell.php:300 Stack
trace: #0
/var/www/html/application/third_party/PHPExcel/Worksheet.php(2458):
PHPExcel_Cell->getCalculatedValue() #1
/var/www/html/application/third_party/PHPExcel/Worksheet.php(2534):
PHPExcel_Worksheet->rangeToArray('A1:F54', NULL, true, true, true) #2
/var/www/html/application/libraries/Excel.php(51):
PHPExcel_Worksheet->toArray(NULL, true, true, true) #3
/var/www/html/application/controllers/broker.php(116): Excel->read(1,
true) #4 [internal function]: broker->upload_debtors_info() #5
/var/www/html/system/core/CodeIgniter.php(339):
call_user_func_array(Array, Array) #6
/var/www/html/index.php(192):
require_once('/var/www/html/s...') #7
{main} thrown in
/var/www/html/application/third_party/PHPExcel/Cell.php on line 300
It appears to be this formula makes the error.
=Table1[[#This Row],[Outstanding Debtor Balance Over T+3 (Rs.)
'[A']]]-Table1[[#This Row],[Portfolio Value (Rs.)
'[B']]]
But I'm not sure how to fix. Thanks if someone can solve it.

Related

gulp 4.0 allowEmpty : true is not working for empty array

gulp.task("f1", () => {
gulp.src([], {"allowEmpty": true})
.pipe(gulp.dest(location));
})
Error: Invalid glob argument: is thrown for the above snippet
gulp.task("f1", () => {
gulp.src("[]", {"allowEmpty": true})
.pipe(gulp.dest(location));
})
whereas, it is working fine. Is this the expected behaviour ? Anyway to use allowEmpty for empty array ?
Anyhow the issue can be solved by skipping the task for empty array, just wondering is there any proper way to use allowEmpty for empty array.
Any suggestion would be helpful. Thanks in advance
It's expected behavior. The first parameter of src() expects either a string or an array of strings, not an empty array. The allowEmpty option just suppresses the error that is thrown if no match is found—it doesn't change what can be passed in the first parameter.

SSIS Cast String to Database Date

I am trying to cast a String (DT_WSTR) as a Date Format (DT_DBDATE) in SSIS.
My source is a Excel-File and the input field looks as follows: OCT 04 2020
My Result should have the format 2020-10-04
I use a Derived Column Editor and created this expression:
(DT_DBDATE)(SUBSTRING([BILLING CYCLE DATE],8,4) + "-" + SUBSTRING([BILLING CYCLE DATE],1,3) + "-" + SUBSTRING([BILLING CYCLE DATE],5,2))
The error I get is:
[Derived Column [312]] Error: An error occurred while attempting to perform a type cast.
[Derived Column [312]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "component "Derived Column" (312)" failed because error code 0xC0049064 occurred, and the error row disposition on "input column "BILLING CYCLE DATE" (388)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Derived Column" (312) failed with error code 0xC0209029 while processing input "Derived Column Input" (313). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
I know that there are several questions that a similar, I also tried a lot of them but nothing helped me so far.
I have no Idea why it is not working as it used to work one month ago. And in other SSIS Packages similar expressions are working fine.
Any answer is appreciated!
I found the solution:
I had to transform the monthname OCT into a number 10.
So tried this solution: Convert month name to month number in SSIS
(SUBSTRING([BILLING CYCLE DATE],1,3) == "OCT" ? "10" : "") + SUBSTRING([BILLING CYCLE DATE],4,3) + SUBSTRING([BILLING CYCLE DATE],7,5)
After that I did the above expression in a seperate Derived Column and it worked very fine!
(DT_DBDATE)(SUBSTRING([BILLING CYCLE DATE],7,4) + "-" + SUBSTRING([BILLING CYCLE DATE],1,2) + "-" + SUBSTRING([BILLING CYCLE DATE],4,2))
You can use a script component transform:
DateTime.ParseExact(Row.stringDate, "MMM dd yyyy", CultureInfo.InvariantCulture);
The inputs are string to convert, format, and culture.

Excel Error Trace IF nested statements

Am trying to trace back an error on a spreadsheet, but am having difficulties tracing it. Here is the code that is present on the cell:
=IF($A$4="","N/A",
IF(OR('Manual Input'!$I$6="ENTER ENGAGEMENT LETTER DATE
(YYYY/MM/DD)",'Manual Input'!$I$6=""),"SEE REVIEW PERIOD START DATE",
IF(AF4="No",
IF(AND(
IF(AND(TRIM(I4)<>"NA",TRIM(I4)<>"N/A",TRIM(I4<>"None"),
MAX(IF(ISTEXT(I4),DATEVALUE(TRIM(I4)),I4),IF(ISTEXT(G4),DATEVALUE(TRI
M(G4)),G4))>($AQ$1-365),IF(ISTEXT(G4),DATEVALUE(TRIM(G4)),G4)>($AQ$1-365)),
IF(ISTEXT(G4),DATEVALUE(TRIM(G4)),G4)
<=IF(ISTEXT(T4),DATEVALUE(TRIM(T4)),T4),TRIM(T4),
IF(AND(TRIM(I4)<>"NA",TRIM(I4)<>"N/A",TRIM(I4)
<>"None"),IF(ISTEXT(I4),DATEVALUE(TRIM(I4)),I4)
<=IF(ISTEXT(T4),DATEVALUE(TRIM(T4)),T4),
OR(TRIM(I4)="NA",TRIM(I4)="N/A",TRIM(I4)="None")),
IF(ISTEXT(G4),DATEVALUE(TRIM(G4)),G4)<=IF(AND(TRIM(U4)<>"NA",TRIM(U4)
<>"N/A"),IF(ISTEXT(U4),DATEVALUE(TRIM(U4)),U4),TRIM(U4)),
IF(ISTEXT(G4),DATEVALUE(TRIM(G4)),G4)<=IF(AND(TRIM(V4)<>"NA",TRIM(V4)
<>"N/A"),IF(ISTEXT(V4),DATEVALUE(TRIM(V4)),V4),TRIM(V4)),
IF(ISTEXT(G4),DATEVALUE(TRIM(G4)),G4)<=IF(AND(TRIM(W4)<>"NA",TRIM(W4)
<>"N/A"),IF(ISTEXT(W4),DATEVALUE(TRIM(W4)),W4),TRIM(W4))),
"Yes","No"),"INVALID VALUES")))
I keep getting a value error. I tried running the Evaluate formula and the following is the sequence before the error happens:
IF(FALSE, #N/A, IF(FALSE, #N/A, IF(TRUE, IF(AND(TRUE, TRUE, "2017/04/24",
TRUE, TRUE, TRUE, TRUE), "Yes, "No"), "Invalid")))
I know that the date is supposed to be a True/False, but am not sure how to correct it. Any help would be good.
Data:
I4 = NA, G4 = 2017/4/20, AQ1 = 2017/03/01
T4=2017/4/24, U4=2017/4/26, V4=NA
Additionally, on clicking error checking, it states that "The value used on the formula is of wrong data type"
I was able to solve the issue. I traced the error back to an AND statement issue.

My less page getting an error If I bundle files?

I realized that some css are not applied on my page if I use bundling some less and css files.
yield return new StyleBundle("~/app/son/styles")
.Include(
"~/angular/angular-ui-select/select.css",
"~/less/bootstrap-slider.less",
"~/less/less/bootstrap-switch.less",
"~/less/employee.less");
When I check the applied less page it s giving an error like that:
Minification failed. Returning unminified contents.
(248,6): run-time error CSS1035: Expected colon, found '{'
(291,5): run-time error CSS1035: Expected colon, found 'input'
(298,5): run-time error CSS1035: Expected colon, found 'input'
(309,5): run-time error CSS1035: Expected colon, found '{'
(326,12): run-time error CSS1035: Expected colon, found '{'
For example for first error line is like that
248.line(pre {):
.example {
pre {
font-size: 14px;
}
And 298 line (td input[type="number"]):
.large-rows {
td input[type="number"] {
width: 120px;
margin-left: 4px;
}
}
As I understand my less file does not behave as less file. why I m getting these errors?

Method 'Range' of object '_Global' failed error when referencing Named Ranges

I got a Method 'Range' of object '_Global' failed error when I'm trying to reference a workbook scope Named Range. I've referenced other Named ranges with the same code, and they all work fine. Only this particular range throws an error.
The function for the named range is this
=OFFSET(INDIRECT(ADDRESS(91,MATCH(Calculation!$G$89,Calculation!$C$90:$S$90,0),,,"Calculation")),,-2,1,5)
I couldn't figure out what's the issue with this, could anyone help me out please? Thanks!
This is the line that throws the error
Set rngVs = Range("'CAR Dashboard.xlsm'!PenLineSelected1Y")
You may want to try:
Set rngVs = Names("PenLineSelected").RefersToRange
If that still fails, then one likely cause of error:
You have -2 for the cols argument in your Offset function. If the Address function returns an address in columns A or B, this will raise a #REF! error.
I put each part of the formula in its own cell just to see where it is failing. Observe that a match in the 3rd column of C90:S90 will not cause an error:
But if I change the search term to "World" (which will be found in column B), the Offset function will fail.

Resources