Lauren has attended:
Excel Advanced course
IF
Hi
We want to use an IF formula in a Vlookup.
the cells are in short date format... we want to do:
IF date is in the previous month, insert cell ***.
how would we go about doing this?
Many thanks,
Lauren
RE: IF
Hi Lauren
Thanks for your question. I wasn't quite sure exactly what you were looking for, so I have a couple of options.
The section I think you're really looking for is an IF function that evaluates if the date is in the previous month, which we can achieve using the MONTH and TODAY function:
=IF(MONTH(date_cell)=MONTH(TODAY())-1,cell***,another_cell)
You could then combine this with your VLOOKUP.
If you would like to use a lookup value to return a date, then assess if the date is in the previous month and insert cell***, then nest the VLOOKUP inside the IF:
=IF(MONTH(VLOOKUP(lookup value,table array,column no.,0))=MONTH(TODAY())-1,cell***,another cell)
If you would like to test if a cell is in the previous month, then insert cell*** as the lookup value, nest the IF inside the VLOOKUP:
=VLOOKUP(IF(MONTH(date_cell)=MONTH(TODAY())-1, cell***,another_cell),table arrray,column no.,0)
Please let me know if you have any further questions about this.
Kind Regards,
Sarah Reid
Excel Trainer