Hi Experts,
Please find my requirement below.
IF mange value < 0 then "NA"
Name | Date | Transaction | Requirement | Comments |
Bird | 01-01-2022 | 200 | Not used in 3 months | NO Negative value in the next months |
Bird | 10-05-2022 | -50 | NA | |
Cool | 02-01-2022 | 300 | used in 3 months | Negative value before 3 months i.e., -30 |
Cool | 03-02-2022 | -30 | NA | |
Cool | 03-03-2022 | 500 | Not used in 3 months | No negative value in the next 3 months |
Cool | 03-07-2022 | -100 | NA | |
Rama | 02-03-2022 | 1000 | used in 3 months | Negative value before 3 months i.e.,-50 |
Rama | 03-03-2022 | 200 | used in 3 months | Negative value before 3 months i.e.,-50 |
Rama | 03-05-2022 | -50 | NA | |
Rama | 03-07-2022 | -100 | NA | |
Rama | 03-10-2022 | 10 | Not used in 3 months | No negative value in the next 3 months |
Rama | 03-11-2023 | -20 | NA | |
Main | 01-01-2020 | 5000 | Not used in 3 months | No negative value in the next 3 months |
Main | 01-02-2020 | 100 | Not used in 3 months | No negative value in the next 3 months |
Main | 02-05-2021 | -50 | NA | |
Main | 02-07-2021 | -100 | NA | |
Main | 02-02-2022 | -500 | NA | |
Main | 02-03-2022 | -50 | NA | |
Main | 02-04-2023 | 400 | Not used in 3 months | No negative value in the next 3 months |
Any suggestions is greatly appreciated.
Thanks
I have given the Output as well as in the "Requirement" column.
Basically there are few conditions:
1. If Transaction amount <= 0 then "NA"
2. If Transaction amount >0 and for every positive value we need to search for negative value for the same name range and check if the date diff between 2 dates <3 months then "USED in 3 months" else "Unused within 3 months"
or 3.If transaction amount >0 and no negative values for that name range or have a negative value but the date diff between two dates is > 3months then "Unused in 3 months"
I hope you will get a better clarity now, please check the data below for your reference.
Bird | 01-01-2022 | 200 | Not used in 3 months | NO Negative value in the next months |
Bird | 10-05-2022 | -50 | NA |
|
Cool | 02-01-2022 | 300 | used in 3 months | Negative value before 3 months i.e., -30 |
Cool | 03-02-2022 | -30 | NA | |
Cool | 03-03-2022 | 500 | Not used in 3 months | No negative value in the next 3 months |
Cool | 03-07-2022 | -100 | NA |
|
Rama | 02-03-2022 | 1000 | used in 3 months | Negative value before 3 months i.e.,-50 |
Rama | 03-03-2022 | 200 | used in 3 months | Negative value before 3 months i.e.,-50 |
Rama | 03-05-2022 | -50 | NA | |
Rama | 03-07-2022 | -100 | NA | |
Rama | 03-10-2022 | 10 | Not used in 3 months | No negative value in the next 3 months |
Rama | 03-11-2023 | -20 | NA |
Main | 01-01-2020 | 5000 | Not used in 3 months | No negative value in the next 3 months |
Main | 01-02-2020 | 100 | Not used in 3 months | No negative value in the next 3 months |
Main | 02-05-2021 | -50 | NA | |
Main | 02-07-2021 | -100 | NA | |
Main | 02-02-2022 | -500 | NA | |
Main | 02-03-2022 | -50 | NA | |
Main | 02-04-2023 | 400 | Not used in 3 months | No negative value in the next 3 months |