I have the following data in 3 columns: ID, date and code. I need a formula that will return the code for a given ID and a random date that falls within a range. The date field could be sorted by ID first then date if necessary.
Table:
Here's an example of the desired output:
Table:
ID | Date | Code |
1 | 5/23/2024 | F |
1 | 5/8/2024 | E |
1 | 4/29/2024 | C |
3 | 5/23/2024 | S |
3 | 5/23/2024 | H |
2 | 5/8/2024 | E |
2 | 4/23/2024 | K |
2 | 5/23/2024 | X |
4 | 5/8/2024 | P |
Here's an example of the desired output:
ID | random date | returned code |
1 | 5/7/2024 | C |
1 | 5/8/2024 | E |
1 | 5/9/2024 | E |