Can we have a onload event for the table created using tabulator - tabulator

I m having a table with 12 columns. Based on the value that is loaded in one of the column, I have to hide 3 columns out of 12. So, the scenario would be if the value in column1 is X then show all the 12 columns and if the value in column1 is Y then show only 9 columns(hide 3 columns). This has to be done when the table containing data is loaded so that user sees only 9 or 12 columns based on the value in column1.
Is there a possibility to write any logic in onload event? is there onload event in Tabulator?
I have tried using adding an event on the cell value but that doesnt help as I need something before any of the cell is being clicked.

Related

Conditional Formatting in Pivot Table in Excel based on text field

I would like to color code a pivot table based on a text field within the data.
This is a mock up, as I'm at a loss as to how this can be done. One of the tricky parts is that you can't actually display the text field that is the basis for the color.
Thank you,
Neil
Contract
Month
PayStatus
Payment
1
Jan-21
Complete
90
2
Jan-21
Complete
95
3
Jan-21
Complete
93
4
Jan-21
Complete
94
1
Feb-21
Pending
91
2
Feb-21
Complete
95
3
Feb-21
Complete
92
4
Feb-21
Complete
94
2
Mar-21
Complete
96
3
Mar-21
Pending
93
4
Mar-21
Pending
94
2
Apr-21
Complete
95
3
Apr-21
Pending
94
Mock-up Pivot Mock-up (color coded)
You still don't need to use VBA to get the results you're looking for, but there is a little work to do in order to set it up. The solution is to use Conditional Formatting in which the formula is VLOOKUP. To make it work, you need to modify your table slightly.
VLOOKUP works by finding a unique value in the first column of a table or range. The first column values in your table are not unique, nor are the values in the second column. But if you combine the first and second columns, you can create a unique value. A column must be added to the left of your data to create this unique value:
The formula in Column A combines the values in columns B and C:
=B2&"+"&TEXT(C2,"mmm")
(There's a reason to format the date as just the Month, more later)
What we're ultimately looking for in your formatting rules is when any value in the pivot table, for a given month and contract, matches either "Complete" or "Pending". Because we've set up the data with the helper column, we can now create a `VLOOKUP' that can work for us. So we need a formula that does this:
VLOOKUP(unique value based on month and contract,get the pay status) = "Complete"
VLOOKUP(unique value based on month and contract,get the pay status) = "Pending"
The formula in the VLOOKUP has to reference back to the source data (when it's inside the pivot table). In order to lookup that unique value, we have to create it by combining values from the pivot table. If the VLOOKUP formula was in Cell B6 in the pivot table:
Then the formula will be:
=VLOOKUP($A6&"+"&B$4,Sheet1!$A$1:$E$14,4,FALSE)="Complete"
Notice how the "lookup value" is not a single cell, but we're creating the same unique string/value in the helper column.
In your pivot table, click in the values area ("Sum of Payment") in Cell B6, then select Home -->Conditional Formatting-->Manage Rules. Next "Add New Rule" and then make sure your rule looks like this:
Create a second rule in the same manner and apply it to the pivot table.

Fill in table based a column of categories in Excel

I have a table that looks like this:
Type Value
Movie 5
Food 3
Gas 10
Food 2
.... ....
And There's a second table I want to fill in with "Value" based on their type in the first table, so that the corresponding rows look like this:
Rent Food Movie Gas Clothing ... ( appear in specific order bc they are subcategories)
5
3
10
2
The title row is already there, so I was thinking there might be some kind of lookup method to do this? How do I do that?
your second table apperas to hold one value per row but it doesn't have a label. it does correlate to the original row number, is this by design or coincidence?
if this is by design then you can use those 2 columns, hide them if you like, get a unique list of categories by copying you r abels to a new colum, removing duplicates in the data tab, then paste special transpose in c1 to create colum headers.
so column a and b remain unchanged
row 1 contains header starting at column c
your data starts at c2
this is the formula
=Iferror(vlookup(C$1,$A2:$B2,2,false),"")
drag it down and to the right
you can copy paste special values when done to remove the formulas
for something with only a hundred or thousand cells this will be one of the easier options but i would not do this on large tables, for those i would use power query or VBA
Assuming your 1st table is in Sheet1 and 2nd table is in sheet2.. you may try to fill in Sheet2!A2
=IF(Sheet1!$A2=A$1,Sheet1!$B2,"")
and drag it all the way.. Hope you get how it works.. and what you need.

Spotfire: calculated column based on column in another table

Is it possible to insert a calculated column (table 1) based on another table (table 2)? Prefer to do it this way instead of joining table because the data on table 2 may keep on changing.
Calc column is derived by taking the f1 value on Table 2 based on matching value from col X on Table 1 to the nearest p1 value of Table 2. If it is possible to do a calculated column based on another table, how do I create an expression for it?
#p.ysl - In order to add column 'f1' to Table 1, Columns 'x' from Table 1 and 'p1' from Table 2 should be matched. As the format of these columns are not the same (one is real and the other is integer), we cannot match them. Though we do, 'f1' added to Table 1 will be blank as the values don't match.
You can add a calculated column to Table 1 with round values. example: 29.23 will be 29 in this column and then add column 'f1' from Table 2 by comparing calculated column 'round(x,0)' from Table 1 and column 'p1' from Table 2. But, the issue is calculated columns cannot be used for relating tables.
One solution is to freeze this calculated column in order to use it for matching columns. But, when we freeze the column, the entire table will be embedded and data cannot be refreshed.
However, you can accomplish this with an R-script.
Go to Register data function under Tools menu:
In the script section, add below script.
t3 <- cbind(t1, round(t1,0))
In Input Parameters section, define what 't1' is.
In Output parameters section, define what t3 is. In this case, the result will be stored as a table.
Now, RUN the script
It will prompt you to assign input and output parameters. Input - assign column 'x' from table 1.
Output parameter will be a new table.
Note: You can save this data function if you want to.
Table 't3' is created. Now, you can add 'f1' column from Table 2 to this table by matching 'column2' and 'p1' as shown in the screenshot below.
To ensure this runs dynamically, Table 1 and Table 2 can be embedded but t3 table should be linked to source so that when new data gets added to Table 1/ Table 2, t3 will be updated automatically.
Hope this helps!

Linked columns in an Excel document

I'm trying to create an excel document with two sheets, the first one containing a list of fruit types, for example
ID Description
1 Apple
2 Orange
3 Pear
...
The second sheet would contain a reference to a row from the first sheet and some additional data.
For example
Fruit_ID Quantity Customer
1 12 Chris
3 7 Jenny
...
And when a user is adding a new row in the second sheet he would be presented with a drop down list of entries from the second sheet when setting the first column value.
The number of rows in the second sheet is dynamic ( user will be adding data into it).
How can I do this ?
Select the cells where you want to display dropdown.
Go to Data Tab > Data Validation
Enter the following criteria
Allow:List
Source: =OFFSET(Sheet1!$A$1,1,0,COUNT(Sheet1!$A$2:$A$1048576))
Change the sheet name accordingly and it will show drop-down based on the Sheet1, column 1.
Let me know if it works.

Get maximum value based on unique values

I have two columns in Excel as follows:
col1 col2
1 10
1 22
1 11
1 23
1 14
2 16
2 12
2 10
2 9
How do I write a command to returns the maximum value from col2 corresponding to each unique value in col1?
So here I need to write a command to get 23 and 16.
The data I have shown here are dummies; I have 600 unique values in col1 in my actual data set.
Pivot tables: the single most underutilized and powerful feature of excel.
File menu:
Insert
Pivot Table
Select range
Fill in as indicated in image below
Step by Step:
Place cursor in cell to right of all data on sheet.
Select insert from menu
select pivot table icon
select pivot table from pop-up of icon
use the button to select the range of cells included (all 600+ rows in 2 columns) (or just enter $A:$B)
select ok
A pivot table field list appears on the right:
Drag and drop row 1 into row labels.
drag and drop row 2 into values area.
left click on "... of Row 2"
select value field settings
select "Max" instead of count or sum
select ok and you should have desired results.
The pivot table will find the max value in row 2 for each unique value in row 1 which is what I believe you are after.
Even if a solution has been found. I think it is too complicated and oversized to use the pivot for this and it might not be possible in all scenarios. Here is one that can be found searching the internet for "max if excel" (e.g. see here; adapted)
{=MAX(IF(A:A=A1,B:B))}
Attention! This is an array formula, you have to enter it without the curly brackets and then press Ctrl+Shift+Enter to submit the formula.
Since the left hand values seem to be in order, Subtotal should work.

Resources