Split Words in the comment text - vba

I am trying to write a macro which will split the comment. My supervisor wants to prioritize the comments, e.g.:
Low : Comment 1
Medium : Comment 2
High: Comment 3
The output should be displayed in Excel with the following headings.
I was able to write a macro to export comments from Word to an Excel file, however I am struggling to add this code snippet to split the comment text.
Comment ID |Page| Section/Paragraph Name |Comment Scope |Comment text |Priority |Reviewer |Comment Date|
1 |1| 1.1heading1| example| heading| Comment 1 |Low |BlueDolphin |1/1/1|
2| 2| 1.2heading |example2 |Comment 2 |Medium| BlueDolphin| 1/1/1|
3| 3 |1.3heading| 3example3|Comment 3 |High |BlueDolphin |1/1/1|
Any help is much appreciated.

This looks pretty straightforward. Just turn on the Macro Recorder, select the cells of interest, click Data > Text to Columns, and follow the prompts. Turn off the Macro Recorder when done. That's it.

Related

Get Position of a String in a field with delimiters BigQuery

I want to get the position of a word in a field that has the following data with the delimiter as "->":
Example:
Row 1| "ACT -> BAT -> CAT -> DATE -> EAT"
Row 2| "CAT -> ACT -> EAT -> BAT -> DATE"
I would like to lets say extract the position of CAT in each row.
Output would be -
Row 1| 3
Row 2| 1
Ive tried regex_instr and instr but they both return position of the alphabet i think not the word
Consider below
select *,
array_length(split(regexp_extract(col, r'(.*?)CAT'), '->')) as position
from your_table
if applied to sample data in your question - output is

Maximise the number of new encounters between guests at a meeting

I am hosting a series of meetings. There are 24 guests. Two or three times each meeting, we break out into different subgroups of between 2-6 people. I would like to maximise the new encounters so I am looking for an algorithm to help me make new matches, so everyone can meet everyone else.
My current idea is to record the data in Google Sheets and then use the QUERY function to analyse the data. (QUERY is very similar to SQL syntax.)
Here's the 'Round1' table:
subgroup1 | subgroup2
==========|==========
Adam | Edith
Ben | Fran
Chris | Gary
Dave |
And the table for 'Round2' looks like this:
subgroup1 | subgroup2 | subgroup3
==========|============|===========
Adam | Ben | Dave
Gary | Fran | Edith
Chris | |
What I want to do is consume that data and output a chart like this which shows me who has met whom:
Adam Ben Chris Dave Edith Fran Gary
Adam X TRUE TRUE TRUE FALSE FALSE TRUE
Ben TRUE X TRUE TRUE FALSE TRUE FALSE
Chris TRUE TRUE X TRUE FALSE FALSE TRUE
Dave etc...
Edith etc...
Fran etc..
Gary etc...
Could anyone help me to think through how I can use QUERY/SQL to turn those input tables into that output chart?
If you look in cell B3 on the new tab on your shared sheet called MK.Help, you'll find this single formula:
=ARRAYFORMULA(IF((B2:2="")+(ROW(A3:A)>COLUMN(B2:2)),,COUNTIF(QUERY(TRANSPOSE('One table'!A:E),,9),"*"&A3:A&"*"&B2:2&"*")+COUNTIF(QUERY(TRANSPOSE('One table'!A:E),,9),"*"&B2:2&"*"&A3:A&"*")))
That is telling you the counts for a heat map based on the tab called OneTable and nothing else. It will self populate indefinitely as you add groups to the OneTable tab.
Is that what you're going for?
I have come up with an answer, with a very laborious process! Maybe if I explain it here, someone can help me think how to make this simpler.
I start with the example data in this sheet.
In the original question I described one table per round, but I don't care in which round someone met, so I can combine all that data into one table. So in this table, each row shows one of the subgroups:
Then I do a long sequence of match(), transpose(), filter(), join(), split(), until I get this table which shows who has met whom:
From there, it is not so hard to generate the output chart I was looking for
This works! But it is not very elegant. I will love to make this simpler.

Libreoffice Calc Finding MAX from a subset of results

I have a Libreoffice Calc workbook for tracking writing, with 3 sheets in it. 'Time Tracking', 'Time Summary' and 'Yearly Stats'. 'Time Tracking' is where user data is entered, 'Time Summary' is a pivot table for 'Time Tracking'; and 'Yearly Stats' shows long-term progress.
Time Summary (running off some test data) looks a bit like this:
|Column A (Weeks) | ... |Column M (Total Words)
-------+-----------------------+-----+----------------------
Row 7 |02/10/17 - 08/10/17 | |3500
Row 8 |13/11/17 - 19/11/17 | |2300
Row 9 |30/04/18 - 06/05/18 | |1000
Row 10 |30/10/17 - 05/11/17 | |700
Yearly Stats looks like this:
|A |B |C
-------+--------------------+--------+----
Row 1 | |2017 |2018
Row 2 |Total Words |6500 |1000
...
Row 7 |Max Words (Week) |3500 |3500
The formula for 'Yearly Stats'.B7:C7 is currently =MAX($'Time Summary'.$M$7:$M$10), but I need to modify it to filter by the year on the column heading.
https://ask.libreoffice.org/en/question/62260/minif-and-maxif-function-in-calc/ looked to be useful, but when I tried it, the MAX from the formula was returning the MAX of ROW - being 10 - rather than ROW returning the position of the MAX value - even though it seems to work in the example file from the link.
The example formula is:
=IFERROR(INDEX($Sheet1.$J$2:$J$13,MAX(ROW($Sheet1.$J$2:$J$13)*($Sheet1.$A$2:$A$13=A2))-1,1),NA())
My formula uses RIGHT() to compare the last two characters of the column heading with the last two chars of the week in $'Time Summary':$A$7:$A$10 and is:
=IFERROR(INDEX($'Time Summary'.$M$7:$M$10,MAX(ROW('Time Summary'.$M$7:$M$10)*(RIGHT($'Time Summary'.$A7:$A$10,2)=RIGHT(B1,2)))-6,1),NA())
I have, of course, remembered to press CTRL+SHIFT+ENTER as the instructions say, to get the array in the formula to work.
So that's the explanation of my problem. What is it that I'm getting wrong?
Ok, this is a bit long-winded, but I've managed to solve the problem by using the following formula:
=IF(MAX(IF(RIGHT(INDIRECT(CONCATENATE("$'Time Summary'.$A7:$A$",COUNTIF($'Time Summary'.$A:$A,"<>''")+2)),2)=RIGHT(B1,2),INDIRECT(CONCATENATE("$'Time Summary'.$Q$",ROW(INDIRECT(CONCATENATE("$'Time Summary'.$Q7:$Q$",COUNTIF($'Time Summary'.$Q:$Q,"<>''")+5))))),0))>0,MAX(IF(RIGHT(INDIRECT(CONCATENATE("$'Time Summary'.$A$7:$A$",COUNTIF($'Time Summary'.$A:$A,"<>''")+2)),2)=RIGHT(B1,2),INDIRECT(CONCATENATE("'Time Summary'.$Q",ROW(INDIRECT(CONCATENATE("$'Time Summary'.$Q$7:$Q$",COUNTIF($'Time Summary'.$Q:$Q,"<>''")+5))))),0)),NA())
It is wrapped in an IF that replaces any 0 result with '#NA' (just for neatness of output).
Also the right half of the ranges specified make use of a calculation to figure out where the bottom row is, leaving out the total, so that's another reason it's so huge.

To find the closest value in the column data in VBA

Iam writing the vba code to check closest value in the range of data.
Ex:In the worksheet("Sheet6") i have value 31.848
and the worksheet("Z73") i have list values
65.47
31.74
54.56
0.16
35.71
26.78
56.54
47.62
39.68
1.55
15.87
32.55
17.86
So i need to take the closest value to the 31.848.
Please help me with macro code to do this.
The general solution to your problem is as follows):
A = 31.848
for each value in your list:
if |A - B| < C then
C = |A - B|
end if
next value
your solution will be stored in C.
This is pseudo code, it will not solve your problem.
As for actual code, as #braX rightfully stated, we need to know what you have tried so far, where exactly you are stuck and what your vba skills are, so we know where to start with our help.

Value to table header in Pentaho

Hi I'm quite new in Pentaho Spoon and I have a problem:
I have a table like this:
model | type | color| q
--1---| --1-- | blue | 1
--1---| --2-- | blue | 2
--1---| --1-- | red | 1
--1---| --2-- | red | 3
--2---| --1-- | blue | 4
--2---| --2-- | blue | 5
And I would like to create a single table (to export in csv or excel) for each model grouped by type with the value of the group as header and as value the q value:
table-1.csv
type | blue | red
--1--| -1-- | -1-
--2--| -2-- | -3-
table-2.csv
type | blue
--1--| -4-
--2--| -5-
I tried with row denormalizer but nothing.
Any suggestion?
Typically it's helpful to see what you have done in order to offer help, but I know how counterintuitive the "help" on this step is.
Make sure you sort the rows on Model and Type before sending them to the denormalizer step. Then give this a try:
As for splitting the output into files, there are a few ways to handle that. Take a look at the Switch/Case step using the Model field.
Also, if you haven't found them already, take a look at the sample files that come with the PDI download. They should be in ...pdi-ce-6.1.0.1-196\data-integration\samples. They can be more helpful than the online documentation sometimes.
Row denormalizer can't be used here if number of colors is unknown, also, you can't define text output fields dynamically.
There are few ways that I can see without using java and js steps. One of them is based on the following idea: we can prepare rows with two columns:
Row Model
type|blue|red 1
1|1|1 1
2|2|3 1
type|blue 2
1|4 2
2|5 2
Then we can prepare filename for each row using Model field and then easily output all rows using text output where file name is taken from filename field. In this case all records will be exported into two files without additional efforts.
Here you can find sample transformation: copy-paste me into new transformation
Please note that it's a sample solution that works only with csv. Also it works only if you have the same number of colors for each type inside model. It's just a hint how to use spoon, it's not a complete solution.