Why do my Excel IF statements generate an error? - excel

Excel 2016
I can't use IF statements when using Excel. If I try, no matter how simple the statement, I get "There is something wrong with this formula". I can set values from other cells, I can do SUM etc but not an IF.
These work
=1+2 (shows FALSE)
=SUM(A1:A6)
This doesn't work
=IF(1+2,3,4) (get error)
I don't have this problem at all when using Excel 2007 (yes it's old) and it shows the value of 4 in the cell no problem. I tried four different data types in the cell (general, number, text and custom) with no luck. I performed a quick repair and an online repair which seemed to download the entire office application and reinstall it also with no luck. If anyone has a clue I'd be most grateful. Thank you!

Related

How do I fix cells in Excel that contain formulas, but are showing as empty cells?

I have tried to find this scenario somewhere but haven't been able to find any useful resources.
Essentially, I have performed some work in Excel and upon returning to the file the row sizes were so large the file could not used properly, and the cells were blank. The row sizes was an easy fix, however the blank cells are strange because they still contain text/formulae.
Has anyone seen this issue before, and know how to fix it?
Thanks!!!!
In this image, you can see that the selected sell contains some text
Here, if I double click to edit the cell contents, there seems to be some kind of disconnect between the location of the cell, and where Excel is allowing me to edit the text
I think you should start working with "formulatext()" Excel function: if you have a formula, this returns a full string
I've seen issues like this in the past and have always first tried the "Text to Columns" Data Tool on the Data Menu. I have used this when cells are unexpectedly blank, or when my dates are registering as dates or formulas are registering as formulas. It might help.

Formula error of hard-coded structured references with Excel tables

I'm trying to use structured references with Excel tables https://support.microsoft.com/en-us/office/using-structured-references-with-excel-tables-f5ed2452-2337-4f71-bed3-c8ae6d2b276e.
If I copy-paste the formula like =DeptSales[[Sales Person]:[Region]] in a cell, Excel returns an "There's a problem with this formula..." error.
One solution is to choose the Sales Person that the intellisense proposes:
I don't understand why hard-coded Sales Person is not accepted. Could anyone help?
PS: the version of my Excel for Windows:
Why dont you type = in the cell where you are putting the formula, then select the target cells with your mouse? Then it should work correctly.
I dont see the calculations that you want to do? Is it count or sum or something?
Please see my example below. It works fine.

What is the simplest way to use a formula to detect if google sheets or microsoft excel is running, and execute the compatible formula accordingly?

Some formulas I'm using only work in Microsoft Excel but not Google Sheets, or a different formula that has the exact same result works in Google Sheets but not Microsoft Excel.
Is there a simple way to detect if Google Sheets or Microsoft Excel is running, and execute the compatible formula accordingly?
I am finding it difficult to believe this question hasn't been asked before but I couldn't find my specific question of the same file working in both Excel and Google Sheets.
I'm not concerned about scripts, just formulas.
There is no official way to determine if Microsoft Excel or Google Sheets is running through formulas, however with some versions of Excel =INFO("RELEASE") will return the version of Excel running, but this doesn't work in Google Sheets.
Thanks to #Slai, =ISERR(-"1pm") results in TRUE in Excel and FALSE in Google Sheets. Excel doesn't understand how to apply math to a time string value, where Google Sheets does, hence the error.
A simple IF statement using this logic can be =IF(ISERR(-"1pm"),"MS-Excel_formula","G-Sheets_formula")
If the formula you're using returns a number, a more simplified version is =IFERROR(GoogleFormula+"0am", ExcelFormula) however this won't work for non-numeric returned formulas because it adds 0 to the result which should not change a numeric result. For instance, =IFERROR(1+"0am", 2) returns 1 in Google Sheets and 2 in Excel.
If Microsoft decides to recognise "1am" or "0am" as numeric time values in future versions of Excel, the above if statements won't work as intended and Excel will attempt to execute the Google Sheets formula.
One boolean solution is to force an error in a function you absolutely know doesn't work in one or the other program. So #Slai 's example would work well no? Also, excel doesn't attempt to implement the Google only functions like ArrayFormula or Importrange &c. FWIW The minor discrepancies are the ones that catch me out - 'DSUM' for example frustrates me in that Google Sheets responds slightly differently to the Excel implementation under certain conditions. There will be others I'm sure but I've not yet found a definitive list or collation thread of these. (PS. I've not expanded my description of the DSUM idiosyncrasy as I suspect it'll be too far off topic).

Excel gives a "wrong formula" error when there OBVIOUSLY isnt one. I copied the formula straight from Microsoft's website

I want to shade alternating rows, so I searched for a formula and found one on Microsoft's site. It's this:
=MOD(ROW(),2)=0
And I've seen it being used in many other tutorials for the same thing too, but my Excel says there's something wrong with it. What is the problem?
If semicolons work for you, you may also need to adapt the function names (mod, row) to their localized versions.

Excel formulas are not being generated by Reporting Services

I'm working on a report for my employer where the end product is a SSRS report, but one that will almost ALWAYS be exported to Excel for further manipulation. In this report, there is a row that is really just a row of calculations based on other cell values.
I've read that Reporting Services can "figure out" Excel formulas, and will generate and insert them where it can so long as your expressions for the cell's value do not contain database field references, only report item references.
Well, I've done this and I'm still not able to get the formulas to come through. I've tried rendering the report every way I could think of, and I've tried modifying the DeviceInfo parameters to include the OmitFormulas option set to False, and still I've come up empty. I've even tried creating a VERY simply table based report with hard-coded values, and even then I don't get formulas.
Here's a sample expression from my report:
=(ReportItems!Balance2.Value + ReportItems!Supply3.Value) - ReportItems!Demand3.Value
My environment is VS 2008 (fully patched/updated) running on SSRS 2008 (not fully patched). I've talked to the server admin, and he says it's running CU1 (I think, can't remember for sure). Our company's Excel is version 2007.
I'm really at my wits end here, so I'm hoping someone out there has dealt with this before and can give me an answer. Thanks!
I have also tried this, the problem here is that SSRS 2008 simply does not support this functionality. It is true that in earlier versions of SSRS it was somewhat supported (2005), however they took that out in the later versions... too bad..
see link:
http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/ddf2f19d-3f70-4bb0-a035-00709ffee2f9
I found a way to do it IF you know the cell addresses, though it's a bit of a hack. In your report, enter the cell formula as a string preceded by an apostrophe, the "this is text" escape character in Excel:
="'=A2+A3"
When you export into Excel the apostrophe will be invisible, but the formula appears as text:
=A2+A3
Now if you do a find/replace and remove the apostrophes (replace with nothing), the formulas will calculate correctly.
SSRS has quite a few limitations when it comes to Excel content. As you mentioned Excel Formulas or even charts for example are rendered as images instead of Excel Charts.
Seeing as you mentioned that you want a report that works in SSRS, but will always be exported to Excel you should really checkout OfficeWriter at http://www.officewriter.com/.
OfficeWriter can integrate with SSRS and will allow you to export a full fidelity Excel document. By that I mean you can have Excel Formulas, not the rendered SSRS formulas, or real Excel charts not the rendered image. These types of things won’t change if your data changes after the file have been rendered and opened by SSRS.
If the “further manipulation” happens by end users then this is great, they can change numbers and the formulas will recalculate and the charts will update.
If the “further manipulation” is programmatic, then you can use OfficeWriters API to continue to manipulate the document.
You may want to give it a look, I hate for you to be on your wits end.
DISCLAIMER: I am one of the developers on OfficeWriter.

Resources