Please let me know if there is a way to enforce cell formatting in Excel workbook.
Basically I have a workbook(template) that I will distribute to my users. My Users then will fill the template with the data and send it back to me. But when the users do the copy and paste from another excel sheet or from other source, the numbers fields are getting automatically converted to number format by Excel. I dont want that. I want to enforce all the fields as text. I cannot add data validation rule because, I dont want to add extra effort to my users to correct the data validation errors.
What I want in this case is that - Excel to keep everything as text and dont add any formatting by its own and also keep the destination formatting no matter what the source formatting is.
Excel versions that I support are greater than Office 2007 format i.e., xlsx files
Please help. Thanks in advance.
Related
I have been working on developing excel vba based forms with my little knowledge. Once in six months, Client ask to change the structure of the forms, insert few fields, delete few fields, give inputs to incorporate few conditions/logics. This is repeated every six months. Also when developing forms for current, they keep changing their inputs. It is really painful to go and edit the forms and macro at the backend which refer each cell value of the specific field/table. I have to do this for each macro present in the form(including Userform, Module, code behind sheets). Input files keep changing and non standard. Please suggest me what is the best way to do the changes in macro, Like formula in excel change automatically when you insert or delete rows or columns, move formula to another cell.
I have an Excel 2007 document with a lot of formulas of the format:
SUMIFS(view1[COLUMN1],view1[COLUMN2],$C13,view1[COLUMN3],I$10)
but when I save the sheet and reopen it each formula is changed to the much less readable (but still accurate) format:
SUMIFS(data!$F$2:$F$65536,data!$B$2:$B$65536,$C13,data!$K$2:$K$65536,I$10)
The formulas all still work, I just want to keep the view as view1[COLUMN1] to make it more readable and to make edits easier.
How do I stop Excel from automatically changing how this shows up in the formula bar?
Suggestion might help on your situation.
Add a column header to your data and convert your data set to a table.
The benefit of using table is your formula will shows the column name instead of cell reference.
It should able to fix your problem.
You can check the below url for more details about Excel Table.
http://www.jkp-ads.com/Articles/Excel2007Tables.asp
Is there any way of using Data Validation to stop someone entering a Formula and only allow text?
I don't want somebody using a formula to search very hidden sheets because they will know the names of these sheets.
I know excel is not secure, but I don't want someone to easily read these sheets with just =SHEET!A1
I have tried custom validation
=ISERROR(FIND("=",A1))
but unfortunately I need to allow them to use the = sign
Yes - really simple - create a Custom data validation and use formula: =NOT(ISFORMULA(A1))
No need to over-engineer it with VBA, but of course its easily disabled
No there is not. The closest you could come would be to write a UDF that detects the presence of a formula; enter that UDF on some cell in the active sheet, and reference that cell in the data validation formula.
However, that would not prevent a user from entering a formula in some other cell, and then copy/paste to the validated cell. Data validation only checks when a formula is entered directly. It does not check that pasted data conforms to the rule(s).
Jeeped's suggestion of using worksheet event code would be the way to go. And you could easily protect the entire sheet from that phenomenon.
An Excel worksheet contains a datewise list of entries. Whenever I open the worksheet, I want today's date entry to be highlighted. For example, when I open the Excel file containing Interest payment amounts and due dates, it should tell me which Interest is due today.
Conditional Formatting is the way to go.
In Excel 2007 (not sure about earlier versions), you can conditional format against formula -- i.e. set a conditional format to equals =TODAY().
(Apologies, I had tried to upload an image for you, but I don't have enough reputation to do so...)
I'm not sure exactly what you're going for, but if you're attempting to just have the data highlighted you can use conditional formatting to cause the appropriate values to be marked out.
If you're trying to make the data actually be re-ordered or show a sub-set of the existing data onto another tab, you'll need to embed some custom visual basic code into your workbook as a macro-enabled workbook (*.xlsm). There are events inside there that can be called when the workbook is opened.
Excel usually treats Conditional Formatting formulas as if they are array formulas, except when loading them from an Excel 2002/2003 XML Spreadsheet file.
This is only an issue with the Excel 2002/2003 XML Spreadsheet format... the native Excel format works fine, as does the newer Excel 2007 XML format (xlsx).
After loading the spreadsheet, it is possible to make it work correctly by selecting the formatted range, going to the Conditional Formatting dialog, and clicking OK--but this only fixes the problem for the session.
Test case:
Enter the following into a new sheet:
A B C
1 N N N
2 x x x
3 x x x
Create this conditional format formula on cells A1:C1 (your choice of pretty colors for the format):
=(SUM(($A1:$C1="N")*($A$2:$C$2=A$3))>0)
This is an array formula that activates for A1, B1, and C1 whenever any of them has an "N" and the cell in row 2 below the "N" is equal to the cell in row 3 of the current column.
(This has been simplified from a real-world business spreadsheet. Sorry for the complexity of the test case, I am trying to find an easier test case to present here.)
And it works... you can alter the N's or the x's in any way you want and the formatting works just fine.
Save this as an XML Spreadsheet. Close Excel, and re-open the file. Formatting is now broken. Now, you can only activate conditional formatting if A1 is an "N" and A2 is the same as A3, B3, or C3. The values of B1, B2, C1, and C2 have no effect on the formatting.
Now, select A1:C1 and look at the conditional formatting formula. Exactly the same as before. Hit OK. Conditional formatting starts working again, and will work during the entire session the file is open.
Workarounds considered:
Providing the file in native (BIFF) Excel format. Not an option, these spreadsheets are generated on the fly by a web server and this is only one of dozens of types of workbooks generated dynamically by our system.
Providing the file in the Excel 2007 native XML format (xlsx). Not an option, current user base does not have Office 2007 or the compatibility plug-in.
Asking users to select the range, enter the Conditional Formatting dialog, and hitting ok. Not an option in this case, unsophisticated users.
Asking users to open the XML spreadsheet, save as native XLS, close, and re-open the XLS file. This does not work! Formatting remains broken in the native XLS format if it was loaded broken from an XML file. If (3) above is performed before saving, the XLS file will work properly.
I ended up rewriting the conditional formatting to not use array formulas. So I guess this is "answered" to some degree, but it's still an undocumented, if obscure, bug in Excel 2002/2003's handling of XML files.
I tried to recreate the problem you describe. Here is what I found.
Could consistently recreate the
problem using Excel 2003 on Windows
XP when saving as an XML
spreadsheet.
Could not reproduce the problem
using Excel 2003 on Windows XP when
saving as a standard xls
spreadsheet.
Could not reproduce the problem
using Excel 2007 on Windows Vista
when saving the file in the native
xlsx format.
Could not reproduce the problem
using Excel 2007 on Windows Vista
when saving the file in the Excel
97-2003 xls format.
(Note: All instances of Excel and Windows are current with all Windows updates.)
I also added a simple conditional formatting formula to each test. In every case, it worked as expected after saving the file, closing Excel, and reopening the file.
So the answer seems to be to use the standard Excel 2003 file format when saving the file.
BTW, this is a very odd formatting formula. It is difficult to imagine how you would use it. It must be a very specific & unusual business case. I also have the feeling something is missing in your post. (I'm not accusing you of being dishonest – just wondering if you may have shortened the formula for readability.) If this is not the exact formula you are using, please edit your original post with the complete formula and I will be happy to revisit this issue.
You can find some tutorial videos for self studying the conditional formatting issue over the following pages:
conditional formatting