PDA

View Full Version : Komplex If-Loop



joshua1990
02-17-2018, 08:50 AM
Hey guys!


I am currently facing a somewhat more complex task and ask for your support :yes

I have data sets in the following structure:
These expand every week. The columns are always the same, but newer data appears for each name.

21636
I have a second table where I have the names 1 time each (1st column).

21637
In the third column, I write a date.
Now I have to somehow implement the following logic:
The goal is to get a "Go" or "Exit" in column "B" to the respective name.

If the selected date is less than the maximum of the record column "C", then write "Exit" in column "F". However, the maximum date only applies to the values with the status 1 (column "B").
However, only write "Exit" if the sum of the values for Status 1 (Data set - column "D") is greater than 20.
If the data is now expanding and the last date from the data set is greater than the one selected, "Exit" should continue to appear as long as the sum of state 1 is not greater than 30.
Then again from 30> Exit and rolling in 10 steps again.

Do you have an idea for that?
Is this possible without auxiliary columns?
Maybe its a new VBA function?




I am thankful for any advice!


Best regards
Josh

SamT
02-17-2018, 10:42 AM
Is this the algorithm you want
For each Set of Names in Table1
For each Subset with 1 in Column B
If Sum of Column D of Subset = (10 + 10n) Then 'Where n >= 1
If SelectDate < Max(Column C Of Subset) Then
Table 2 Column B = "Exit"
Else Table 2 Column B = "Go"




If the data is now expanding and the last date from the data set is greater than the one selected, "Exit" should continue to appear as long as the sum of state 1 is not greater than 30.
Then again from 30> Exit and rolling in 10 steps again.

I tried to incorporate that, but I don't truly understand it.

joshua1990
02-17-2018, 10:56 AM
Hey! Thanks for your approach und reply!
I'm sorry for my bad English, I'll try again.


If I get a new record next week, the person or name may have new data.
If this data or the maximum day / date is greater than my selected date, Exit should not appear until the sum of D is greater than 30. So Exit once the limit has been exceeded and if new records come then again when the new level (10+) was reached.


I hope this is understandlicger, otherwise likes to let you know