Hey!
I have been looking for a way to pass a single parameter generated in my app to a macro. I guess such a thing exists but I cannot find it even after long research ...
Also my macro I have been working on is kind of a tile tool, but redundant. I am not sure if there is another much simpler way to do it.
I try to simplify my problem: having in input records for some persons and some years (not necessarily consecutive) with data associated, and a parameter N, I want to have in rows the data of each existing N consecutive years for the same person.
For N=2:
My input
Name | Year | Data ... |
N1 | Y1 | d11 |
N1 | Y2 | d12 |
N1 | Y3 | d13 |
N2 | Y2 | d22 |
N2 | Y4 | d24 |
N2 | Y5 | d25 |
My (goal) output
Name | Start Year | Data-1 ... | Data-2 ... |
N1 | Y1 | d11 | d12 |
N1 | Y2 | d12 | d13 |
N2 | Y4 | d24 | d25 |
The problem is, N is a dynamic parameter and I don't know how to pass it to my macro.
Here are some pieces for my solution.
SequenceValid indicates if a row is a valid start for a N-sequence.
EDIT : change the annotation of image 2
I don't know what to do with the ??? yet to make it as in my example.
Solved! Go to Solution.
Hey Joe
I thank you for your answer, I did not expect to have an answer to my two questions at once!
I worked a bit on your solution, so that the macro works for an input with several data fields (not only one), and the output has one field per year and per data field.
Here is the macro, I hope it can help.
Thanks, very useful examples