IF statement and Vlookup together

rfinnegan

Board Regular
Joined
Mar 15, 2005
Messages
173
Office Version
  1. 365
Platform
  1. Windows
Hi All:

I'm trying to combine an IF statement with a Vlookup, but don't know if it is even possible.

My goal is to use vlookup to find a value in a report, but if the report wasn't completed, to then calculate a default value based on some other data.

Right now I'm running the vlookup, then when I see a #div/0 value (#div/0 is what is in the cell if the report wasn't done), I put in a second formula.

Here's my vlookup that works fine -
=VLOOKUP(A26,'Audit Scores'!C$5:H$88,5,0)

Here's the formula I use if the vlookup returns an #div/0
=IF(F6>1,0.85,0)

How can I combine them?

Thanks in advance
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
=iferror(Vlookuphere,yourformulahere) which means if your vlookup returns an error then the formula will kick in.
 
Upvote 0
On Excel 2007 and later...
Code:
=IFERROR(VLOOKUP(A26,'Audit Scores'!C$5:H$88,5,0),IF(F6>1,0.85,0))

On all versions...
Code:
=LOOKUP(9.99999999999999E+307,CHOOSE({1,2},IF(F6>1,0.85,0),
     VLOOKUP(A26,'Audit Scores'!C$5:H$88,5,0))
 
Upvote 0
Thanks a million. Looks like I need to upgrade to 2007.

Quick question about the first part of the equation "=LOOKUP(9.99999999999999E+307,CHOOSE({1,2}" what exactly is it doing?

Thanks again
 
Upvote 0
Thanks a million. Looks like I need to upgrade to 2007.

You are welcome.

Quick question about the first part of the equation "=LOOKUP(9.99999999999999E+307,CHOOSE({1,2}" what exactly is it doing?

Thanks again

a) CHOOSE creates here a two-item array, consisting of the results of the two
formula expressions: the IF and VLOOKUP bits. Such an array would look like:

{0.85,45}

or

{0.85,#N/A}

or

{0,#N/A}

b) LOOKUP ignores error values like #N/A. And LOOKUP with that big number
as look up value always returns the last numeric value (if such exists) from
the two-item array (or any other reference for that matter).

From (a) and (b), we obtain the desired result as we intend.

Here some links on LOOKUP and the big number:

http://www.mrexcel.com/forum/showthread.php?t=102091
http://www.mrexcel.com/forum/showthread.php?t=310278 (post #7)
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,448
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top