Previous list item in formula



Is there a way to assign a value depending on the previous list item?

In my case, I need to assign the value 1 to the week 5, value 2 to the week 6 and so on until week 9. The values always go from 1 to 5, however the week number might change (for instance, choosing RFC24/01, value 1 is to be assigned to week1 ecc)

I tried to use the codes of the week but it does not seem to work.

Thanks in advance,