Alteryx WorkFlow for deleting column values from different rows based on certain column conditions - alteryx

Hi I have a data table like this
Group CODE Quantity Value FLAG
A AP 10 100 1
A AM 10 200 1
A AP 03 50 2
B AM 50 150 2
I want to check if the column values for GROUP & CODE are equal & FLAG values are different, Then i want to subract Value with FLAG 1 to Value with Flag 2 and update it to new column as Delta.
If there exist no match with the column values for Group & Code then just update "0" to new Column as Delta.
The output data will look like this
Group CODE Quantity Value FLAG Delta
A AP 10 100 1 50
A AM 10 200 1 0
A AP 03 50 2 0
B AM 50 150 2 0
I would like to do this in Alteryx. Thanks for your support & Help

Related

Sumif of multiple Index matches against one value

Need help regarding Excel dynamically search based sum of two columns matching from two different tables.
I have got this Table of Data Entered One Time
A B C
1 Qlty Warp Weft
2 Stpl.1 150 20
3 Cotn.1 80 60
4 Stpl.2 20 20
5 Cotn.2 20 20
6 Stpl.3 20 40
in Column A2:A6, Quality can not be duplicated, its a unique Name
The Data entry and report Table is here
A B C D E F
8 Yarn Name Sent Bags Remaining Qualty Used Warp Used Weft
9 20 800 600 Stpl.1 71 200
10 150 101 30 Stpl.2 70 30
11 40 300 290 Stpl.3 100 10
12 20 400
C9:C5000 is Returning Column, Values are calculated on the base of Column A9:A5000 (Yarn Name)
Need to Find Yarn Name (eg:) "20" in B2:B6 AND/OR C2:C6, wherever it matches, index that Quality from A2:A6
Then match the returned qualities(could be more than one) to D9:D5000 and sum the mathced results from E9:F5000
I have tried so far in C12
=SUMIF($A$9:$A12,A12,$B$9:$B12)-(SUMIF($D$9:$D12,INDEX($A$2:$A$6,MATCH(A12,$B$2:$B$6,0)),$D$9:$D12)+SUMIF($D$9:$D12,INDEX($A$2:$A$6,MATCH(A12,$C$2:$C$6,0)),$D$9:$D12))
PS:- I am using Excel 2007
If I understand correctly, then following array formula can help you:
=SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,(MMULT(--($B$2:$C$6=A9),TRANSPOSE(COLUMN($B$2:$C$6)^0))>0)*(ROW($B$2:$C$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($E$9:$E$12+$F$9:$F$12))
Array formula after editing is confirmed by pressing ctrl + shift + enter
Edit:
To calculate Warp and Weft columns separately use following array formula:
=SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,((A9=$B$2:$B$6)*ROW($B$2:$B$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($E$9:$E$12))+SUM(IFERROR(INDEX($A$2:$A$6,N(IF(1,((A9=$C$2:$C$6)*ROW($C$2:$C$6))-1)))=TRANSPOSE($D$9:$D$12),0)*TRANSPOSE($F$9:$F$12))

Calculate a value for 2 different set of IDs in excel

My excel table has 5 Rows: Id, ColA, ColB, Count and Test.
ID A B Count Test
2 a low 5 -
2 b high 6 -
2 c low 7 -
2 d high 8 -
2 e low 9 -
1 a low 1 =(1-5)
1 l high 2 -
1 e low 3 =(3-9)
I want to Calculate the value of Test for only rows with Id = 1
If Value of ColA for ID 1 = Value of of ColA for ID 2 and
Value of ColB for ID 1 = Value of of ColB for ID 2
then calculate the difference between the Count Values
else
0
The Excel Table is connected to Sql Query. Every time I refresh it the table has a different number of rows.
I tried using VLOOKUP in TEST column where Id = 1 and specified the array table as the first 5 rows (only with Id = 2) but it doesn't seem to work because when I refresh the table the second time there are only 2 rows for Id = 2.
I want the TEST column value to be automatically calculated each time the table is refreshed. Thanks!
use countifs to find if it exists, and sumifs to return the value:
=IF(AND(A2=1,COUNTIFS(B:B,B2,C:C,C2,A:A,2)),D2-SUMIFS(D:D,B:B,B2,C:C,C2,A:A,2),0)

Filter 0-values in PivotTable

I have the following Excel spreadsheet:
A B C
Product Sent Quantity Returned Quantity
1 Product A 500 0
2 Product A 400 300
3 Product A 600 400
4 Product B 250 0
5 Product B 300 150
6 Product C 700 0
The table shows the sales (Column B) an returns (Column C) of a product.
I created a Pivot-Table out of the data above which leads to the follwoing result:
Sum of Sent Quantity Sum of Returned Quantity
Product A 1.500 700
Product B 550 150
Product C 700 0
Now I use the Returned Quantity as a Report Filter.
I set "150" as the filter criteria and I get the following result:
Sum of Sent Quantity Sum of Returned Quantity
Product B 550 150
So far everything works fine.
Now I change the filter from "150" to "0" and I get the following result:
Sum of Sent Quantity Sum of Returned Quantity
Product A 500 0
Product B 250 0
Product C 750 0
However, my target result is:
Sum of Sent Quantity Sum of Returned Quantity
Product C 700 0
What do I have to change to reach my target result?
So, I have entered your data in "Sheet1" like this:
Then, in "Sheet2" I made folowing table:
Which is your pivot table. But cells are defined with formulas:
B2: =SUMIF(Sheet1!$A$2:$A$7,Sheet2!A2,Sheet1!$B$2:$B$7)
C2: =SUMIF(Sheet1!$A$2:$A$7,Sheet2!A2,Sheet1!$C$2:$C$7)
The rest is just matter of draging it down (it will adjust automatically, as you know). Now, just lock first row and then you can apply any filters to it.
Here's a slightly different way to do it, which only requires one table, and allows you to filter and display values in your pivot table:
A B C D
1 Product Sent Quantity Returned Quantity Sum of Returned Quantity
2 Product A 500 0 700
3 Product A 400 300 700
4 Product A 600 400 700
5 Product B 250 0 150
6 Product B 300 150 150
7 Product C 700 0 0
The formula in cell D2 is =SUMIF($A:$A,$A2,C:C) Copy this formula down the column.
Then set Sum of Returned Quantity as your filter, and it should work correctly. Additional columns may be added for additional filters and you can hide the subtotal column(s) if you wish.

In Excel how do subtract values from list table when I preform a transaction?

If I have two tables where I have list of things in 1 table and the other table serves as a transaction table. But every time I do a transaction the value of units in the transaction should be subtracted from the lists table. Can anyone please help?
Let's say table 1 looks like this:
A B C
1 Item Start Value Current Value
2 ---- ----------- -------------
3 1 20
4 2 100
5 3 95
and table 2 has transactions recorded as a list of Item numbers in column E and associated value movements in column F, then the formula in C3 should be:
=B3-SUMIF(E:E,A3,F:F)
This formula can then be copied down for the other entries in table 1

Identify Rows with Same Values in 2 Different Columns

I have a data set of roughly 405,000 rows and 23 columns. I need the records where the value in column "D" is the same as the value in column "H" for that row.
So for
A B C D E F G H
13 8 21 ok 3 S - of
51 7 22 no 3 A k no
24 3 23 by 3 S * we
24 4 24 we 3 S ! ok
24 9 25 by 3 S # we
75 2 26 ok 3 S 9 ok
etc...
I'd get back the 2nd row, the 6th row, etc...
A B C D E F G H
51 7 22 no 3 A k no
75 2 26 ok 3 S 9 ok
Based on other posts like: Formula to find matching row value based on cells in multiple columns I tried using a Pivot Table, but it complains I can't put either of my two columns in the "Columns" area because there is too much data. With both columns in the "Rows" area, I get a relationship of D to H, but I can't then find a way to filter on only those where D = H.
I've also looked into countifs(), vlookup, and index / match functions, but I can't figure this out. Help please.
I would do a simple "IF()" formula in a new column.
For your example add a new column I and use the following formula in the first data row (I2):
=IF(D2=H2,"Yes","No")
Fill down to the end of the data.
Then using Excel filters or countif you can check the number of "Yes" vs "No" in your data.

Resources