Forum Discussion
Expression Error We cannot apply operator - to types Text and Text
- Anonymous2 years ago
Thanks for reaching out to the community, Candi .
It's an easy question. I reproduced it.
The step I did was subtract 1 from the [Hours] column, and the reason for the error was that my [Hours] was of type text.(Text cannot be added or subtracted.)
Just turn the [Hours] column into a numeric type before performing the subtraction step.
Of course, if you're not here for addition and subtraction, you're trying to add a "-" between the fields and the fields. Then you can do it as follows.
Another note, the merge must be text, e.g. [Hours] is a numeric type and not a text type, you need to modify the code as follows
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
We need more info than this. Can you show the data and the formula throwing the error?
Full disclosure, my former coworker built this power query. He showed me how to solve a lot of the errors that we encountered in the past, but this one is new.
I'm not sure which data/formula is causing the error. I've gone into the power query editor to try to figure it out and I believe I've identified which table is the problem, but I've gone through the entire source workbook, but still couldn't find the issue.
- ronrsnfld2 years agoSuper User
Go through the applied steps and see on which step that error first appears. The error means pretty much what it says. You have text data that you are trying to subtract.
- Candi2 years agoNew Member
Ok. Thanks
- Candi2 years agoNew Member
Possibly a silly question, but there are names included in the fields where the last names are hypenated. Is there a possiblity that it's interpreting this as subtracting text?
- ronrsnfld2 years agoSuper User
Unlikely, but without data and code, it is not possible to tell you precisely how to change things to avoid this error.