4 ms·
Umm, if you are treating them as text cells, then adding them would product 12345678 since you are concatenating strings. I just don't think there is any good s
by zrobotics 4y ago
Umm, if you are treating them as text cells, then adding them would product 12345678 since you are concatenating strings. I just don't think there is any good solution for this, since it's effectively impossible to automatically distinguish numbers that the user wants to treat as strings (like a zip code) and numbers that should be treated as floats or ints.
- Dylan16807 4y ago+ is not concatenation in any spreadsheet program I've seen, and it probably shouldn't be concatenation in anything. That's the solution, having a separate concatenation operator.
- boston_clone 4y agothe '+' operator provides concatenation of strings in both python and C; in Excel, you use '=CONCAT()'... just syntactic differences, is all.
- zrobotics 4y agoYeah, I spend more time doing data manipulation in python than in excel, so I thought that excel would do that as well.
- Dylan16807 4y agoIt's not just a syntactic difference. It's a huge UX difference that one operator always does an addition on both numbers and numeric strings, and another operator always concatenates both numbers and numeric strings. The looser your typings the more it matters, and spreadsheets barely even have types.
- wizofaus 4y agoIn C? How?
- boston_clone 4y agosorry, meant cpp! C (apparently) uses a function that more closely resembles Excel
- wizofaus 4y agoC has strcat but that only does the easy part - allocating and freeing the memory is still the caller's b job.
- wizofaus 4y agoTend to agree that choice of + for string concatenation was a mistake - anyone know the history/first widely used example? Did the original BASIC have it? (I think QuickBasic did, but that's unlikely to be the origin). Edit: found https://retrocomputing.stackexchange.com/questions/20460/what-was-the-first-programming-language-to-use-for-string-concatenation https://retrocomputing.stackexchange.com/questions/20460/wha..., suggests it was ALGOL-68.
- deleted 4y ago[deleted]
- ineedasername 4y ago+ is not a cancatenation operator in excel. It is numeric addition. It is added the numeric values of which the letter characters are merely a representation then that answer would be the same as if excel treated them as numeric data types. Alternatively, if you don’t want excel to perform addition on underlying numeric values but instead only on defined data types then the formula could result in NaN which would signal to the user that the explicit data type was not compatible with addition. I know, complaining like this probably doesn’t make sense. It’s a minor issue to begin with and I’m probably an edge case as far as excel users go. It doesn’t make sense for MS to tailor its product for my type of user.