Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

how to create formula for column has same values and need to replace another column

troy_mech
8 - Asteroid

I have table with two columns Column 1 and Column 2. I want to create formula if Column 1 has same values then corresponding row in Column 2 to be replaced with 'Y" where this has null or "N"

13 REPLIES 13
andyuttley
11 - Bolide
11 - Bolide

Hi, you can just use a formula tool for this:

 

if [column A] = [column B] then “Y” else “N” endif 

 

...if this gives you what you want @troy_mech ? 

grazitti_sapna
16 - Nebula

Hi @troy_mech,

 

Can you please share some sample data with required output?

 

 

Sapna Gupta
troy_mech
8 - Asteroid

I should have explained clearly, I need formula to update Y where column 1 has same values and also when column 2 has value of Y.

 

Venkatesh_Sampath_0-1597227172548.png

 

grazitti_sapna
16 - Nebula

Hi @troy_mech,

 

If I have understood your problem then below is the solution for your problem:

 

updating_values.png

 

I hope you don't mind the sorted output.

 

PFA the Workflow.

 

If this solves your issue then please mark it as the solution. I hope I have been able to help you

Sapna Gupta
seven
12 - Quasar

Hi @troy_mech 

 

the best practice is to use a Bool data type. That also makes for a simpler calculation. You can directly compare the fields without an IF statement. Bool data types are also much faster computationally. If you still want to have the "Y" and "N", you can convert them before output.

troy_mech
8 - Asteroid

Thank you for your workflow, but it's not the required solution. The workflow will not produce the output correctly if I  changed the values in Column B.

I want to create formula based two criteria,

1) have to check column A has same values

2) for the same values if anyone values in Column B has Y then all values in Column B corresponding to Column A should be Y

seven
12 - Quasar

Hi,

 

I feel confused by what you mean by "column A has same values". The same values as what?

 

From the sample, it looks like you are checking rows in Column A and matching them somehow. How? Are you taking the first two rows, comparing them, moving on to the next two rows, and so on? How does it work/

troy_mech
8 - Asteroid

For example, If Column A contain value as "B" then we have to check Column B values. Then anyone of cell value has Y then every cell value should be updated as "Y" in Column B corresponding to Column A which has "B".

 

Venkatesh_Sampath_0-1597244791407.png

 

seven
12 - Quasar

What do you check if the value of Column A is "A", "C", etc? "Then anyone of cell value has Y" what does that mean? You are checking a range of cells?

Labels