I am working on a server that will update a list each day. The list will look like the following example.
+---+------------+-------------+-------------+-------------+
| | A | B | C | D |
+---+------------+-------------+-------------+-------------+
| 1 | Name1 | 1 | 2 | true |
| 2 | Name2 | 2 | 3 | true |
| 3 | Name3 | 1 | 1 | false |
+---+------------+-------------+-------------+-------------+
In this example I only used 2 table (except for the name) but in the real list there are 15 columns, with each containing other numbers (some columns can also have the same value).
I also have a last column that is filled with value true or false. This column will be filled on the next day that i receive the other values.
What I want to program is a algorithm that will be able to search for a pattern(s) that are most common for all the row's with he value true.
I want to program this in NodeJS but have no idea how I am able to do this, any idea's?
considering the algorithm is derived from previous stored values of various columns which correspond to last column being true.
If we consider linear relationship between various columns like
y=a1*c1+a2*c2...+a14*c14
where c1 is column 1 and a1 is coefficient.Then for example we "might" get some relation like.
y>0.5 then true
y<0.5 then false
but remarks are
this will only hold true if there exists a linear relation between the columns.
This will be fuzzy clustering i.e. there might be outliers when you calculate true or false with your above equation.
Some non linear relation ship might exist between the column values which may not be covered in above relationship.
Related
I have a spreadsheet of transactions with unique IDs.
For each transaction, there may be two rows corresponding---one initiating, one fulfilling.
As new information keeps flowing in, I want to find the initiating rows if the current row is a fulfilling. Since they will have different IDs, the only way to match them is by the amount, type, account number, and transaction date.
Each of the criteria are not unique. For example, there may be many transactions with amount of $500.
As a result, I want to write a formula that returns the transaction ID if and only if all these criteria match a row in the spreadsheet.
I tried to work with arrays thinking i can multiply them since they will be either 0 or 1 and the product will only be 1 if all criteria match, but could not get it to work since it will just return one value, instead of an array of values.
So the spreadsheet has the following structure:
ID | Account Number | Transaction Date | Amount | Customer | Fulfilling order ID? |
1 | 123456 | 06/26/2018 | 50 | John | |
2 | 123457 | 07/25/2018 | 55 | Steve | |
3 | 123456 | 06/26/2019 | 50 | John | 1 |
4 | 124588 | 07/25/2019 | 75 | Rich | |
5 | 125589 | 08/01/2019 | 80 | Vincent| |
I want to be able to write something that will return 1, on order ID 3, since it is fulfilling order ID 1.
You can certainly use dynamic ranges within array formulas, so you don't have to manually keep changing ranges when you enter data.
Something in cell F2 along the lines of:
=INDEX(A:A,MATCH(1,($B$1:INDEX(B:B,COUNTA(B:B))=B2)*($C$1:INDEX(C:C,COUNTA(C:C))=C2)*($D$1:INDEX(D:D,COUNTA(D:D))=D2)*($E$1:INDEX(E:E,COUNTA(E:E))=E2),0))
Entered as array through CtrlShiftEnter, wouldnt work?
Note
In your example it would never return a 1, but just a 3 simply because the criteria don't match (column c, dates are different). As soon as they are the same, the formula works.
first of all, thank you in advance.
the problem I am facing is I have two different values I need to combine when I lookup against a different table, however I do not know which columns those two combinations will be, and they can be different per row. hopefully, the example will help
look up table
ID | Benefit | Option | Tier | Benefit | Option | Tier
123| 1 | 1 | 3 | 2 | 7 |3
456| 2 |3 |1 |1 |3 |2
current table
ID | Benefit |
123 | 1
123 | 2
456 | 1
456 | 2
the example i am giving there is only two posibility it can be in but my actual program is it could be in maybe 20 different location. the one positive i have is that it will always be under the benefit column, so what i was thinking is concat benefit & 04 and using the index match. i would like to dynamically concat based on the row my lookup is on
here is what i got so far but its not working
=INDEX(T3:X4,MATCH(N4,$S$3:$S$4,0),MATCH($O$3&O4,T2:X2&ADDRESS(ROW(INDEX($S$3:$S$4,MATCH(N4,$S$3:$S$4,0))),20):ADDRESS(ROW(INDEX($S$3:$S$4,MATCH(N4,$S$3:$S$4,0))),24),0))
where
ADDRESS(ROW(INDEX($S$3:$S$4,MATCH(N4,$S$3:$S$4,0))),20) does return T3
and ADDRESS(ROW(INDEX($S$3:$S$4,MATCH(N4,$S$3:$S$4,0))),24) returns x3
so i was hoping it would combine benefit&1 and it would see its a match on t 3
I guess you are trying to find a formula to put in P4 to P7 ?
=INDEX($S$2:$X$4,MATCH(N4,$S$2:$S$4,0),SUMPRODUCT(($S$2:$X$2="wtwben")*(OFFSET($S$2:$X$2,MATCH(N4,$S$3:$S$4,0),0)=O4)*(COLUMN($S$2:$X$2)-COLUMN($S$2)+1))+1)
If the values to return are always numeric and there is only one match for each ID/Benefit combination (as it appears in your sample) then you can get the Option value with this formula in P4 copied down
=SUMPRODUCT((S$3:S$4=N4)*(T$2:W$2="Benefit")*(T$3:W$4=O4),U$3:X$4)
[assumes the headers are per the first table shown in your question, i.e. where T2 value is "Benefit"]
Notice how the ranges change
....or to return text values.....or if the ID/Benefit combination repeats this will give you the "first" match, where "first" means by row.
=INDIRECT(TEXT(AGGREGATE(15,6,(ROW(U$3:X$4)*1000+COLUMN(U$3:X$4))/(S$3:S$4=N4)/(T$2:W$2="Benefit")/(T$3:W$4=O4),1),"R0C000"),FALSE)
I don't know if I am missing something obvious or what, but I cannot wrap my brain around what I need from this. I have a table with products available for sale and various criteria. I have a second table with a smaller list of stores and a second column of whether I should include them in my results set. In this example, I would never include store 789, but I might include 123 and/or 456, depending on whether an "x" was placed in that second column.
So, for my results, I would break them out by Product and color with a simple SUMIFS statement. However, I really want to be able to filter the sites out if they are "x" on that second tab. Any thoughts on how I could easily do that? I did insert a column on my raw data sheet and just added an if statement, then I used that as a 4th criteria in my SUMIFS, but I was looking for a more elegant solution.
I can get either matching stores or the rest of the filters, but I cannot figure how to make both work together in the same statement or how to include them if they are "x"-ed.
This will get me the filtered stores
=SUMPRODUCT(SUMIF('Tab1'!A:A,'Tab2'!A:A,'Tab1'!D:D))
Either of these will get me the filtered products:
=SUMIFS('Tab1'!D:D, 'Tab1'!B:B, A2, 'Tab1'!C:C, B2)
=SUMPRODUCT(--('Tab1'!B:B=A2), --('Tab1'!C:C=B2), 'Tab1'!D:D)
Tab1
Store | Product | Color | Sales
--------------------------------
123 | A | Red | 1
123 | A | Blue | 2
123 | B | Red | 4
456 | A | Blue | 8
456 | B | Red | 16
789 | A | Red | 32
789 | B | Red | 64
Tab2
Store | Include
---------------
123 |
456 | x
Results:
Product | Color | Sales
------------------------
A | Red | 0
A | Blue | 8
B | Red | 16
Why not use VLookUp's to add the column from Tab2 to Tab1?
For example, new Column E, to the right of Sales:
=VLookUp(A1, "Tab2", 2, False)
...and fill-down?
You could base SumIf criteria on multiple tables but personally I'd just keep the data together (dynamically) just to make it easier and neater.
Build a pivot table and use slicers to include or exclude specific data. Then you don't need a helper table and you don't need formulas, either. Just a few clicks.
I have this question that puzzles me. Two columns of unique text entries in a worksheet all having a number next to each of them.
How can I compare the values for each pair of text and find the ones where the associated numbers are NOT the same.
Not even sure how the output would be. Maybe using Conditional Formatting highlighting the value in the first column where the match in the second one is different???
Thank you for your time.
Let's have some sample table.
+-----+---+-------+---+------------------------------------+
| A | B | C | D | =VLOOKUP(C1;ALL_VALUES;2;FALSE)=D1 |
+-----+---+-------+---+------------------------------------+
| abc | 1 | fasfa | 4 | #N/A |
+-----+---+-------+---+------------------------------------+
| aa | 2 | abc | 1 | TRUE |
+-----+---+-------+---+------------------------------------+
| dd | 3 | dd | 2 | FALSE |
+-----+---+-------+---+------------------------------------+
Where ALL_VALUES is named range of you table (here A1:D3). Formula returns TRUE when match is found, else it return False Or #N/A(You can transform #N/A by IfError function). Then you can filter the result in table based on this or you conditional formatting... Depends on what suits you better ;)
What I am trying to do is simply replicate an excel sheet on Tableau. However, my worksheet shall contain many columns having been calculated using other columns. Calculating a field is not much in Tableau I understand but I want to see the changes happening in the calculated field as one enters the data in the parent field on the dashboard directly. For example I put up the following data on Tableau:
x y(=x*5) z(=x+10)
1 5 11
2 10 12
3 15 13
4 20 14
5 25 15
I would like to see the values of y and z change automatically as the values of x are fed in directly on the dashboard.
I am not able to figure out how to accomplish this on tableau. Would be highly obliged on any help extended. Thanks in Advance.
I know its late but if you still need this to answer then here is my speculations. I am assuming this is how you want your table to be:
| Column X | Column Y| Column Z | A | B | C | ... |
-------------------------------------------------------
| 2 | 10(2*5) | 12(2+10) | 2 | 4 | 1 | ... |
| 4 | 20(4*5) | 14(4+10) | 3 | 1 | 3 | ... |
| 8 | 40(8*5) | 18(8+10) | 6 | 0 | 9 | ... |
| . | . | . | . | . | . | ... |
| . | . | . | . | . | . | ... |
-------------------------------------------------------
You can create calculated fields for ColumnY and ColumnZ . In calculated columns you can you use lookup to find value in a particular column (here ColumnX) and perform calculations on it.
Here is how you create your calculated column:
ColumnY
LOOKUP(SUM(ColumnX),0) * 5
and
ColumnZ
LOOKUP(SUM(ColumnX),0) + 10
Have a look at this LOOKUP function Lookup Table calculation function
Regards
You are essentially talking about parameters. A complete detailed article can be found here
Parameters are dynamic values that can replace constant values in
calculations and can serve as filters. For example, you might have a
calculated field that returns True if Sales are greater than $500,000,
and otherwise returns False. Using a parameter, you can replace the
constant value of $500,000 in the calculated field with a parameter
than you can change dynamically using the Parameter control.
In your case, you can simply create a parameter X, that will be entered by user on the fly, and then in turn use x in the calculations of y and z, thus accomplishing your requirements.
If input is of concern to you than Tableau also enables you to create user based input into your parameters. You can create columns that run off these input, such as Column 1 = X (Parameter 1) * Y (Parameter 2)
To set this up create the parameters, name them, and define their input ranges. For example say Parameter 1 can take integers from 1-1000. Then do the same for Parameter 2.
Next create a calculated field where field = X*Y
Do this for as many variables (parameters) and as many equations (columns) as you want! there you go, the dynamic table.