Choose Language Hide Translation Bar
Highlighted

## Column formula help

Hello all,

How do I get the average value between row 3 and row 4 by using variables? I was thinking of doing something like the following, but it did not work 1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

## Re: Column formula help

I am sorry, but I do not completely understand what you are trying to do.  Hopefully, to continue the conversation, and to possibly give you some methodologies to review, I have some JSL below that creates a data table similar to your table, with 3 different formulas using different methods of calculating a mean.  Take a look at it, and see if it gets you what you want, or if not, then can you be more specific in exactly what you are trying to calculate.

``````New Table( "Example",
New Column( "Label",
Character,
"Nominal",
Set Values( {"Dry", "Wet", "outlet Dry", "Outlet Wet"} )
),
New Column( "a",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [80, 67, 57, 55] ),
Set Display Width( 47 )
),
New Column( "b",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [79, 66, 59, 57] )
),
New Column( "c",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [88, 77, 66, 55] )
),
New Column( "One",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
dt = Current Data Table();
Mean( dt[Row(), Index( 2, 4 )] );
)
),
New Column( "two",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
dt = Current Data Table();
Mean( dt[Index( 3, 4 ), Index( 2, 4 )] );
)
),
New Column( "three",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
dt = Current Data Table();
theColumns = dt << get column names( numeric );
Remove From( theColumns, 4, 2 );
Mean( theColumns );
)
)
)``````
Jim
2 REPLIES 2
Highlighted

## Re: Column formula help

I am sorry, but I do not completely understand what you are trying to do.  Hopefully, to continue the conversation, and to possibly give you some methodologies to review, I have some JSL below that creates a data table similar to your table, with 3 different formulas using different methods of calculating a mean.  Take a look at it, and see if it gets you what you want, or if not, then can you be more specific in exactly what you are trying to calculate.

``````New Table( "Example",
New Column( "Label",
Character,
"Nominal",
Set Values( {"Dry", "Wet", "outlet Dry", "Outlet Wet"} )
),
New Column( "a",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [80, 67, 57, 55] ),
Set Display Width( 47 )
),
New Column( "b",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [79, 66, 59, 57] )
),
New Column( "c",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [88, 77, 66, 55] )
),
New Column( "One",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
dt = Current Data Table();
Mean( dt[Row(), Index( 2, 4 )] );
)
),
New Column( "two",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
dt = Current Data Table();
Mean( dt[Index( 3, 4 ), Index( 2, 4 )] );
)
),
New Column( "three",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
dt = Current Data Table();
theColumns = dt << get column names( numeric );
Remove From( theColumns, 4, 2 );
Mean( theColumns );
)
)
)``````
Jim
Highlighted
Article Labels

There are no labels assigned to this post.