Hi all I have been trying to fin out how to use AND and OR together on the same formula.
I'm trying to resolve the following issue :
The person will get a discount only if they are working on the Cerrovial project or if they are working on the Parinas project but the risk of the job must be Low
I tried to use a formula and excel gave me an error and also fixed my formula but I do not know if this is correct or what the "*" means
=IF(OR(D14="CerroVial",D14="Parinas")*AND(E14="Low"),"8%","")
You were close:
=IF(AND(OR(D14="CerroVial",D14="Parinas"),E14="Low"),"8%","")
All the elements of the AND need to be in the AND(...), just like for the OR, which you had done correctly.
Related
I have modified some VB sample code to get most of what I need done using the QuickBooks SDK in an app launched from Excel using VBA. I am able to produce both a Time by Job Summary report and a Job Estimates vs. Actuals report, but for the latter I need to produce filtered copies of it for each customer:job reference number, and I'm not sure what the proper syntax is for this even after looking over the specific query in the API Reference for QB Desktop.
I'm fairly sure that this needs to be done during the request phase. Also, I'm using QBFC, so I have tried various combinations that seem logical, but still haven't received the desired output. If it helps, an example of what is needed for the filter would be like: 20-5050 Dan Barton Trucks. Below is my code for the request:
Set jobRQ = requestSet.AppendJobReportQueryRq
customerRef = "20-5050 Dan Barton Trucks"
With jobRQ
.JobReportType.SetValue ENJobReportType.jrtJobEstimatesVsActualsSummary
.ReportEntityFilter.ORReportEntityFilter.EntityTypeFilter.SetValue etfCustomer
' .ReportEntityFilter.ORReportEntityFilter.FullNameList.Add (customerRefID)
.ORReportPeriod.ReportPeriod.FromReportDate.SetValue dateFrom
.ORReportPeriod.ReportPeriod.ToReportDate.SetValue dateTo
.SummarizeColumnsBy.SetValue scbTotalOnly
.IncludeSubcolumns.SetValue True
.DisplayReport.SetValue True
End With
I have commented out the line that doesn't work.
When I'm merging cells with phpspreadsheet using a variable I have an issue.
On opening in MS Excel (2019), it says that the program can try to recover the document if I'm sure it's a reliable one.
When I say yes, the document is ok and the merging worked fine.
Why do I have that message?
I don't have this message on this way :
$spreadsheet->getActiveSheet()->mergeCells('B2:F2');
But on this way I have this message :
$cellRange = 'B2:F2';
$spreadsheet->getActiveSheet()->mergeCells($cellRange);
MergeCells is a sensible function. If you try to/accidentally make overlap cell groups this kind of error. Be sure that your code not do something like this:
for($i=1; $i<3; $i++){
$cellRange = 'B'.$i.':F'.$i;
$spreadsheet->getActiveSheet()->mergeCells($cellRange);
}
My mistake was :
I was using that merging tool on a "for" loop and I was trying to merge an already merged cell with another one.
--Edit - Solved by use of COUNTIFs --
So I am trying to see if something is possible with the below section.
I want to count how many rows are "Used&Finance" and how many are "New&Finance" etc. I cannot work out how I would do so... I hope you can help.
--edit added example data--
Does the below work for you?
I9: =COUNTIFS($H$2:$H$7,LEFT(H9,SEARCH(" ",H9)-1),$I$2:$I$7,MID(H9,SEARCH(" ",H9)+1,LEN(H9)))
I10: =COUNTIFS($H$2:$H$7,LEFT(H10,SEARCH(" ",H10)-1),$I$2:$I$7,MID(H10,SEARCH(" ",H10)+1,LEN(H10)))
looking for help on what should be a very basic function. I am trying to get a SUM of a specific value, however I do not seem to get the syntax correct.
Here is what I have
=Sum(Fields!PriorYearSalesDollars.Value - Sum(Fields!PriorYearCost.Value
+Sum(Fields!PriorYearFrtCost.Value)))
However I get an error when trying to sum. Is there another way to test this also? Each time I modify the expression I then have to save the report and upload to the report server and test again. If I do it through the preview function in visual studio it throws a generic error on the whole report. When running from report server, just this specific column shows #Error
This is the syntax that works after FIRST changing the column format to numbers where I accidentally did it as currency first. Not sure why currency didn't work, but this is correct.
=Sum(Fields!PriorYearSalesDollars.Value) - (Sum(Fields!PriorYearCost.Value) + Sum(Fields!PriorYearFrtCost.Value))
I have another puzzling problem.
I need to read .xls files with RODBC. Basically I need a matrix of all the cells in one sheet, and then use greps and strsplits etc to get the data out. As each sheet contains multiple tables in different order, and some text fields with other options inbetween, I need something that functions like readLines(), but then for excel sheets. I believe RODBC the best way to do that.
The core of my code is following function :
.read.info.default <- function(file,sheet){
fc <- odbcConnectExcel(file) # file connection
tryCatch({
x <- sqlFetch(fc,
sqtable=sheet,
as.is=TRUE,
colnames=FALSE,
rownames=FALSE
)
},
error = function(e) {stop(e)},
finally=close(fc)
)
return(x)
}
Yet, whatever I tried, it always takes the first row of the mentioned sheet as the variable names of the returned data frame. No clue how to get that solved. According to the documentation, colnames=FALSE should prevent that.
I'd like to avoid the xlsReadWrite package. Edit : and the gdata package. Client doesn't have Perl on the system and won't install it.
Edit:
I gave up and went with read.xls() from the xlsReadWrite package. Apart from the name problem, it turned out RODBC can't really read cells with special signs like slashes. A date in the format "dd/mm/yyyy" just gave NA.
Looking at the source code of sqlFetch, sqlQuery and sqlGetResults, I realized the problem is more than likely in the drivers. Somehow the first line of the sheet is seen as some column feature instead of an ordinary cell. So instead of colnames, they're equivalent to DB field names. And that's an option you can't set...
Can you use the Perl-based solution in the gdata instead? That happens to be portable too...