Forum Discussion
Davidm54
Feb 02, 2021Copper Contributor
The dreaded Apostrophe is turning numbers into text in a forms spreadsheet
I answered my first question by checking one of my other sheets, but this one is a bit trickier.
When people use MS Forms, even for questions I have added restrictions to so it must be a number, in the associated spreadsheet, the data is presented as text, specifically: '2, '3 etc.
This obviously then limits options as far as what can be done with the data, conditional formatting, calculations, etc, all go out the window.
https://www.youtube.com/watch?v=TsqrVAdWRfE
This vid has a serviceable couple of solutions if it was a one off problem, however, this is a table being updated from form responses, and I'd like to remove the apostrophes as soon as new data is in there, automatically. (Regular formatting doesn't do the job.)
(I could not get the VBA solution offered in below video to work, unsure if I messed up, or if the fact it's dealing with a table makes a difference.)
Help please!
I guess the Form is linked to Excel file hosted on SharePoint site. That issue is known for years, at least two workarounds
1) If you have column [Question 1] which have number as text, you may add to the table additional column Q1 as =@[Question 1]*1, or =CLEAN(@[Question 1])*1, etc and work with these columns. Adding of additional columns into the forms table won't crash the process.
2) Instead of linked table use Power Automate which is triggered by form submit and adds rows to the table in your file. In this case not linked with the Form. Transformation could be done within Power Automate flow.
14 Replies
Sort By
- PMark_Copper Contributor
Davidm54 Following. Crazy that it has been 4 years and the issue persists. Following another discussion that has the same issue.
- sd admIron ContributorIt makes sense, though, since Forms is just using a text question with "restrictions" on the numeric parts of an alphanumeric string.
What is needed is an actual numeric question type, and then in addition to the current number restrictions (greater than, not between, etc) you could have things like # of digits, allow decimal places, allow/disallow negative numbers, integers only, etc.
- Star_DIron ContributorThanks for specifying that you use restrictions.
I always use restrictions and can't recall seeing this issue, so I thought that was the cause when a user reported it to me.
Now I know that isn't necessarily the solution. - adversiIron Contributor
I guess the Form is linked to Excel file hosted on SharePoint site. That issue is known for years, at least two workarounds
1) If you have column [Question 1] which have number as text, you may add to the table additional column Q1 as =@[Question 1]*1, or =CLEAN(@[Question 1])*1, etc and work with these columns. Adding of additional columns into the forms table won't crash the process.
2) Instead of linked table use Power Automate which is triggered by form submit and adds rows to the table in your file. In this case not linked with the Form. Transformation could be done within Power Automate flow.
- Davidm54Copper ContributorAs this has been bumped, I'll just add that whenever I do this now, I tend to just use Power Query instead of Power Automate. you can PQ in the same form workbook to a new sheet. Keeps raw data safe and solves this issue.
I'd Power Query into another workbook and keep updated by Forms one untouched. If you use data model in that workbook you may publish it on Power BI and schedule refresh, but it depends how often it shall be updated. One more option is email reports (mainly tables) from this workbook using another Power Automate flow.
- Davidm54Copper ContributorThanks. Re 1. That's good to know re extra columns, I've added columns at the end on form response sheets, but haven't been game to add columns in the middle.
2. That is the work around I ended up with this time. It's worked well, as with numbers in place, everything flows pretty easily from that. Far less reliance on formulas for what we need now, just a couple of pivots and some sheets referencing other sheets and splicers to allow folks to glance at what they want.It's always better to split Excel workbook on 3 zones
- source/raw data
- data preparation
- reporting
First is filled automatically by SharePoint app triggered by Forms
- in second you may generate any table and perform any calculation to transform data
- in third could be PivotTables / Charts based on second part.
- PeterBartholomew1Silver Contributor
Sub TextToNumber() Dim LO As ListObject Set LO = ActiveSheet.ListObjects(1) With LO.ListColumns(1).Range .NumberFormat = "General" .Value = .Value End With End Sub
[The Table name or column name could be used in place of its index]
- Davidm54Copper ContributorThanks. I'll definitely look at using that, this won't be the last time forms is being used.
- PeterBartholomew1Silver Contributor
I see no reason why the macro solution should not work provided your worksheet is 'Sheet1' and the data is brought into column 1. Since you say you are using Excel Tables, it would be a more precise way of defining the range to edit to use the column of the list object as opposed to sheet-based references.
- Davidm54Copper Contributor
Well, this is not a perfect solution, but if you set up a flow with power automate, the data can be dumped to a different spreadsheet and stays as numbers.