Is there a way to stop percentage from converting in a formula?
I have two columns Value and Units that individuals are filling out. Some rows will have percentages for the Value and others will have numbers. I have third column Current Value that combines Value and Units, but when someone enters a percentage
Example:
- Value = 15.25%
- Unit = "women in Group A"
- Current Value Formula
= [Value]@row + " " + [Unit]@row
- The formula converts that to ".1525 women in Group A".
- What I want it to convert to "15.25% women in Group A"
Best Answers
-
MichaelTCA ✭✭✭✭✭✭
Hello,
When using a simple function like this with a mix of text and numbers, the function converts the cell format to a text (string). Removing the % format for numbers. This is definitely something that needs to be addressed by Smartsheet, if possible.
From a programming standpoint, I understand the separation, but even if a cell is a % being changed to text, it should be converted properly. The code would have to be updated if this were to be "fixed".
Attributes cannot be both a text and number or the software will fail.
You can try using a helper column:
None of the cells are formatted as a % in this example.
I usually hide the helper columns if there's multiple people viewing the same sheet.
-
Samuel Mueller Overachievers
@sharkasitswould something like this work then?
If(value@row<=1, value@row*100+"% "+unit@row, value@row + unit@row)
If someone enters 0.25 it will return 25% ..., or if someone enters 25, it will return 25 ....
Unless you can have a value that's less than 1 that's not a percent, or a value greater than 1 that is a percent. Otherwise you will need the checkbox stating this is a percent.
Answers
-
Samuel Mueller Overachievers
@sharkasitsYou probably have to do the conversion manually
=value@row*100+"% "+unit@row
-
sharkasits ✭✭✭✭
Thanks@Samuel Muellerthat would work if all the values were percentages, but many aren't so I can't apply that logic to the full column. Do you know if there is a way to identify if the value entered is a percentage?
I tried using
找到(“%”,[价值]@row)
but it still returns 0 when the % is entered.
-
Samuel Mueller Overachievers
@sharkasitsYou could do if the value is <= 1 maybe. But it appears that if it's an actual number the percent does not appear in a find formula. It's just a formatting thing.
-
Toufong Vang ✭✭✭✭✭
@sharkasits, this will work for any numeric value in the "Value" column.
=IF(Value@row = INT(Value@row), Value@row + "00.00% ", INT(Value@row * 100) + "." + MID((Value@row + "0000"), FIND(".", Value@row + "0000") + 3, 2) + "% ") + Unit@row
Explanation
Value@row = INT(Value@row)
checks to see if the value is a whole number (an integer). If so, simply append "00.00%" to it. ---Value@row + "00.00% "
If the value is not a whole number, then:
(1) Multiply the value by 100 and use INT() to grab everything left of the decimal ---
INT(Value@row * 100)
(2) Append "0000" to the original value and return the 2 numbers that are 3 positions from where we find the "." ---
MID((Value@row + "0000"), FIND(".", Value@row + "0000") + 3, 2)
(3) Concatenate the result from #1, "." , result from #2, and "% "
Append Unit@row to the result of the IF() statement.
Cheers!
-
MichaelTCA ✭✭✭✭✭✭
Hello,
When using a simple function like this with a mix of text and numbers, the function converts the cell format to a text (string). Removing the % format for numbers. This is definitely something that needs to be addressed by Smartsheet, if possible.
From a programming standpoint, I understand the separation, but even if a cell is a % being changed to text, it should be converted properly. The code would have to be updated if this were to be "fixed".
Attributes cannot be both a text and number or the software will fail.
You can try using a helper column:
None of the cells are formatted as a % in this example.
I usually hide the helper columns if there's multiple people viewing the same sheet.
-
sharkasits ✭✭✭✭
Thank you@MichaelTCA. It sounds like I would have to put it to the user to identify if the value is a percentage with a checkbox or something.
The API has displayName which shows the the value as a string. I guess I could do some helper columns and run a job outside to update the percentages, but the values wouldn't be updated real time. I wish we had access to displayName in the formulas for things like this.
-
MichaelTCA ✭✭✭✭✭✭
@sharkasits这将工作。如果函数在helpe嵌套r column can evaluate what to return depending on the checkbox and input.
Honestly, I don't know much about the API in Smartsheet.
I hear ya though! Or at the very least, a function to convert the type.
You could try this too. Another way to use helper columns that I like to call "The Long Way". Use the JOIN function to combine them. The JOIN1 column; there is no delimiter so there's nothing between the values. The JOIN2 column has a " " delimiter.
I'm writing out a sentence in the columns and using the JOIN function. It's kind of like a back door.The only inputs you would need is the value and unit. The output would be from the JOIN2 column.
-
Toufong Vang ✭✭✭✭✭
@sharkasits, you don't necessarily need to ask the user if the value they entered is a string (e.g., 20.25%) or a numeric value (e..g., 0.2025).
If the values in the columnValuecontains a mix of strings and numbers, then you can create a helper column, (e.g.,Value_Num) into which you can convert the cell entry into anumeric valueusing a formula like...
=IF(ISTEXT(Value@row), IFERROR(VALUE(SUBSTITUTE(Value@row, "%", "")) / 100, VALUE(Value@row)), VALUE(Value@row))
..and then use my updated formula..
=IF([Value_Num]@row = INT([Value_Num]@row), [Value_Num]@row + "00.00% ", INT([Value_Num]@row * 100) + "." + MID(([Value_Num]@row + "0000"), FIND(".", [Value_Num]@row + "0000") + 3, 2) + "% ") + Unit@row
Note, also, that Smartsheet number/column formatting can obscure the fact that some entries are strings while others are numeric. In the screenshot below, the circled entries remain strings while the rest are numeric. The formula inValue_Numconverts the string values into numeric values so that the formula inCOL10works as you originally requested.
-
Toufong Vang ✭✭✭✭✭
-
sharkasits ✭✭✭✭
@Toufong Vangthe problem I have is that the field can contain percentages or non percentage numbers. So sometimes someone so it could be Value: 12 Units: Dogs -> 12 Dogs or Value: 12% Units: Dogs -> 12% of Dogs.
-
Samuel Mueller Overachievers
@sharkasitswould something like this work then?
If(value@row<=1, value@row*100+"% "+unit@row, value@row + unit@row)
If someone enters 0.25 it will return 25% ..., or if someone enters 25, it will return 25 ....
Unless you can have a value that's less than 1 that's not a percent, or a value greater than 1 that is a percent. Otherwise you will need the checkbox stating this is a percent.
-
sharkasits ✭✭✭✭
I don't have enough control over what gets entered. It's a wide array of metrics that changes from year to year. I think the checkbox is the best solution.
-
MichaelTCA ✭✭✭✭✭✭
@Toufong Vang@sharkasitsI like the process Toufong Vang uses. From a programming stand point, the functions can do a lot more than convert the view of a decimal to percent. Thank you for sharing that! I'm definitely writing them down to reference in the future.
For user inputs, a checkbox can make it easier. Having the boolean variable can also make conditions in analyzing data further along easier and with shorter formulas. Having a standard input like 15.25 instead of .1525 would also help remove extra columns and require less formulas.
The trick will be to use cross-references and columnsas little as possibleif you're going to be analyzing the data from the same sheet foryears to come. Smartsheet has its limits.
Categories
<\/p>
=VALUE(IFERROR(JOIN(DISTINCT(COLLECT([Customer PO Amount (USD)]@row:[Customer PO Amount (Local Currency)]@row, [Customer PO Amount (USD)]@row:[Customer PO Amount (Local Currency)]@row, <>\"//www.santa-greenland.com/community/discussion/comment/\"))), \" \"))<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]},{"discussionID":109460,"type":"question","name":"IF \/ OR formula then Check a Box","excerpt":"I need a formula that IF a specific column has either 1 of 2 specific choices, then a BOX in another column is checked: =IF(([Study Status]@row = \"Active\/ Open to Accrual\", 1) OR([Study Status]@row = \"In Start-Up\", 1))","snippet":"I need a formula that IF a specific column has either 1 of 2 specific choices, then a BOX in another column is checked: =IF(([Study Status]@row = \"Active\/ Open to Accrual\", 1)…","categoryID":321,"dateInserted":"2023-08-25T13:30:39+00:00","dateUpdated":null,"dateLastComment":"2023-08-25T16:21:27+00:00","insertUserID":9250,"insertUser":{"userID":9250,"name":"Susan Swisher","url":"https:\/\/community.smartsheet.com\/profile\/Susan%20Swisher","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-25T16:23:49+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"updateUserID":null,"lastUserID":161714,"lastUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-27T02:16:35+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":9,"countViews":46,"score":null,"hot":3385956126,"url":"https:\/\/community.smartsheet.com\/discussion\/109460\/if-or-formula-then-check-a-box","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109460\/if-or-formula-then-check-a-box","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109460,"commentID":392616,"name":"Re: IF \/ OR formula then Check a Box","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392616#Comment_392616","dateInserted":"2023-08-25T16:21:27+00:00","insertUserID":161714,"insertUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-27T02:16:35+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T15:13:03+00:00","dateAnswered":"2023-08-25T14:14:39+00:00","acceptedAnswers":[{"commentID":392575,"body":"
Give this a try:<\/p>
=IF(OR([Study Status]@row = \"Active\/Open to Accrual\", [Study Status]@row = \"In Start-Up\"), 1)<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]},{"discussionID":109457,"type":"question","name":"Conditional Formatting (modified date not in the last 3 weeks)","excerpt":"I would like to use Conditional Formatting (highlight the entire row yellow) if the modified date is not within the last 3 weeks. So any row that has not been recently updated (last 3 weeks) should be highlighted in yellow. Is this spmething that can be done directly within conditional formatting or should I first create a…","snippet":"I would like to use Conditional Formatting (highlight the entire row yellow) if the modified date is not within the last 3 weeks. So any row that has not been recently updated…","categoryID":321,"dateInserted":"2023-08-25T12:33:14+00:00","dateUpdated":null,"dateLastComment":"2023-08-25T12:40:57+00:00","insertUserID":161267,"insertUser":{"userID":161267,"name":"Jef Snyders","title":"Jef Snyders","url":"https:\/\/community.smartsheet.com\/profile\/Jef%20Snyders","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/4HJAEW33KBD0\/nXEKEZE5EQEV4.jpg","dateLastActive":"2023-08-25T13:32:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":161267,"lastUser":{"userID":161267,"name":"Jef Snyders","title":"Jef Snyders","url":"https:\/\/community.smartsheet.com\/profile\/Jef%20Snyders","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/4HJAEW33KBD0\/nXEKEZE5EQEV4.jpg","dateLastActive":"2023-08-25T13:32:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":26,"score":null,"hot":3385935251,"url":"https:\/\/community.smartsheet.com\/discussion\/109457\/conditional-formatting-modified-date-not-in-the-last-3-weeks","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109457\/conditional-formatting-modified-date-not-in-the-last-3-weeks","format":"Rich","tagIDs":[437],"lastPost":{"discussionID":109457,"commentID":392553,"name":"Re: Conditional Formatting (modified date not in the last 3 weeks)","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392553#Comment_392553","dateInserted":"2023-08-25T12:40:57+00:00","insertUserID":161267,"insertUser":{"userID":161267,"name":"Jef Snyders","title":"Jef Snyders","url":"https:\/\/community.smartsheet.com\/profile\/Jef%20Snyders","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/4HJAEW33KBD0\/nXEKEZE5EQEV4.jpg","dateLastActive":"2023-08-25T13:32:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T12:40:09+00:00","dateAnswered":"2023-08-25T12:37:47+00:00","acceptedAnswers":[{"commentID":392551,"body":"
There is no direct way to do this. Adding a checkbox helper column with something similar to this and then formatting based on the checkbox is the simplest way. You can even hide the extra column, as there is no reason for it to be visible.<\/p>
=IF([Modified Date]@row < TODAY(-21), 1, 0)<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":321,"name":"Smartsheet Basics","url":"https:\/\/community.smartsheet.com\/categories\/smartsheet-basics%2B","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":437,"urlcode":"conditional-formatting","name":"Conditional Formatting"}]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=321&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":4991,"limit":3},"title":"Trending in Smartsheet Basics","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">