Sharepoint calculated column - InfoPath Dev
in

InfoPath Dev

Sharepoint calculated column

Last post 06-11-2020 03:55 PM by ipisors. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-11-2020 02:00 PM

    Sharepoint calculated column

    I have a Sharepoint calculated column which I have created without using Infopath, just by creating a new column of type Calculated, and putting this formula: =IF(Average_1to3=1,"Low",IF(Average_1to3=2.3,"Low Mod",IF(Average_1to3=4,"Mod",IF(Average_1to3=3.7,"Mod",IF(Average_1to3=5.3,"Mod",IF(Average_1to3=7,"Mod High",IF(Average_1to3=5,"Mod",IF(Average_1to3=6.7,"Mod High",IF(Average_1to3=8.3,"High",IF(Average_1to3=10,"High")))))))))) Average_1to3 is the name of a numeric column that is set to 1 decimal place. I used the quick edit feature to edit the grid. Average_1to3 shows 6.7. But instead of the calculated column showing "Mod High", it says "No". I am thinking something to do with returning a boolean value from an unrealized If statement. But isn't my If statement correct? It's how I would do that same logic if it were Excel? What am I doing wrong.
  • 06-11-2020 03:47 PM In reply to

    Re: Sharepoint calculated column

     The documentation says the syntax is: IF(logical_test,value_if_true,value_if_false)

    You might want to start smaller -  just with one of your values, like: IF(Average_1to3=1,"Low","Test")

    Then, when you know that is working, replace "Test" with your next IF and so on. 

    Hilary Stoupa

  • 06-11-2020 03:55 PM In reply to

    Re: Sharepoint calculated column

    Thanks for replying. As I pondered this more and more, I began thinking about my Average column. Given the fact that the true "average"s included a heck of a lot more potential precision than 1 decimal point, I realized what was happening------sharepoint was making me think it was storing just one decimal point in my Numbers column (which I had set to Number datatype, decimal places=1). And yet, values like 5.3 weren't being found by my IF statement at all. (I noticed the IF statement worked fine on the whole numbers). Therefore, and this seems bad on Microsoft's part, while you can tell SP to store a number as one decimal place, it's really storing a lot more precision than that (un-asked). Because other columns that perform arithmetic on the number column will not see it as #.# ----They must be seeing it as something else. I can reproduce this behavior by creating a list with 2 number columns, a calculated column that averages them set to Number, decimal places=1, and an IF statement that evaluates what is in the Average column. Despite the average column showing, for example, 2.3, the IF statement will not recognize that the average column shows literally 2.3 Problem solved, I restructured my IF formula to look between generously bounded numeric ranges, and everything worked. I felt very hacky doing that. :)
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.