Forum Discussion
Conditionally filling cells
I have three columns of data. Column one is specific dates pertaining to a number of events recorded on that day in column two.
Ex:
1 2
Date | Events per day
3/24/1999 | 2
3/26/1999 | 1
3/28/1999 | 1
The third Column is a continuous run of dates from the start period to the end period. How would it be best to populate a fourth column corresponding to the run of dates from column three using the corresponding data from columns one and two, while filling the cells with no corresponding dates with 0.
Ex:
1 2 3 4
Date | Events per day Date | Events per day
3/24/1999 | 2 3/24/1999 | 2
3/26/1999 | 1 3/25/1999 | 0
3/28/1999 | 1 3/26/1999 | 1
3/27/1999 | 0
3/28/1999 | 1
3/29/1999 | 0
It's a long list of dates so I don't want to input it manually. Initially I thought about using an If statement comparing if the dates then populating column 4 appropriately but I couldn't figure out how to have it descend the columns properly.
=IFERROR(VLOOKUP(C2,$A$2:$B$4,2,FALSE),0)VLOOKUP along with IFERROR returns the intended result in my understanding.
1 Reply
- OliverScheurichGold Contributor
=IFERROR(VLOOKUP(C2,$A$2:$B$4,2,FALSE),0)VLOOKUP along with IFERROR returns the intended result in my understanding.