Forum Discussion
how do you manipulate an individual cell value using an IF conditional
- Dec 07, 2023
That's good, if your scenario is so simple, GDW11 . Then... please mark NikolinoDE 's post as answer (:
GDW11 Your requirements are incomplete. You say that if the conditioning value is T, then the target value becomes 0, and if the conditioning value is F, then the value remains unchanged. What about blank conditioning values? Other letters? Because the response by NikolinoDE assumes your conditioning column is fully populated with T or F, no blanks. Also he assumed that your conditioning column is A, actual value is column B, and you put your formula in a separate column called target. This may not be a correct assumption because it seems you want to modify the target cell rather than show a value conditionally in a separate column. In this case, you should convert your excel range to a table and create a PowerQuery object from that table. Then select your column, choose "Replace Value", enter any source/target value, after which you adjust the generated formula with something like:
= Table.ReplaceValue(#"Changed Type",each [target_column],each if [condition_column] = "F" then 0 else [target_column],Replacer.ReplaceValue,{"target_column"})Of course, without knowing the requirements, and why you need this, it's difficult to answer your question. However, you have 2 options: go with a simple Excel formula and have an extra column, or create a PowerQuery table and transform the data inside PQ. If your requirement is the only requirement, I would suggest to go with the simple Excel formula. If you have more complex requirements, you may not be able to implement them via formulas, in which case you should go with the PowerQuery.
Hope that helps.
For single line modification, the if works just fine. What I forgot to mention is that I am using a template and I was hoping that the if conditional could work using it in the template. My format rules in the template are properly executed when using the template.
- g0ldfinchDec 07, 2023Copper Contributor
That's good, if your scenario is so simple, GDW11 . Then... please mark NikolinoDE 's post as answer (: