Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

if

ResolvedVersion 365

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

Wed 19 Apr 2017: Automatically marked as resolved.

Excel tip:

Select blank cells automatically

Get Excel to find any blank (empty) cells in a region for you by:

1. Selecting the appropriate region from your spreadsheet.

2. On the menu bar, go to Edit - Go to.

3. Click the 'Special' button, then select Blanks and click OK.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.12 secs.