SOLVED

Help with Excel EXP formula with Vlookup and IF function spitting #N/A

%3CLINGO-SUB%20id%3D%22lingo-sub-2437675%22%20slang%3D%22en-US%22%3EHelp%20with%20Excel%20EXP%20formula%20with%20Vlookup%20and%20IF%20function%20spitting%20%23N%2FA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2437675%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20calculate%20a%20formula%20using%20EXP(%20)%2C%20in%20it%2C%20I%20use%20the%20IF%20function%20and%20the%20Vlookup%20function.%20I%20have%20tried%20it%20in%20different%20ways%20and%20I%20think%20the%20issue%20lies%20within%20the%20VLookup%20function.%20I%20have%20the%20dates%20available%20within%20the%20range%20of%20my%20VLookup%20in%20the%20other%20sheet%20(Input%20Market%20Data%20(2)%20)%2C%20but%20somehow%20it%20keeps%20spitting%20out%20%23N%2FA.%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20images%2C%20the%20column%20of%20dates%20is%20from%20%22Input%20Market%20Data%20(2)%22%20and%20the%20Formula%20is%20the%20one%20that%20keeps%20spitting%20out%20%23N%2FA%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screen%20Shot%202021-06-11%20at%209.41.18%20AM.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F287969i2E2538DE781CAAD0%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screen%20Shot%202021-06-11%20at%209.41.18%20AM.png%22%20alt%3D%22Screen%20Shot%202021-06-11%20at%209.41.18%20AM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screen%20Shot%202021-06-11%20at%209.41.09%20AM.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F287970i9CE9CA4C4E3DC761%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Screen%20Shot%202021-06-11%20at%209.41.09%20AM.png%22%20alt%3D%22Screen%20Shot%202021-06-11%20at%209.41.09%20AM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E2%80%83%E2%80%83%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2437675%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20on%20Mac%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2437762%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20with%20Excel%20EXP%20formula%20with%20Vlookup%20and%20IF%20function%20spitting%20%23N%2FA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2437762%22%20slang%3D%22en-US%22%3EThe%20image%20is%20really%20too%20small%20for%20my%20tired%20eyes%2C%20and%20too%20blurry%20when%20I%20try%20to%20enlarge%20it.%20It%20is%20always%20better%20to%20attach%20an%20Excel%20file%2C%20not%20an%20image.%20And%20that%20is%20probably%20even%20more%20true%20for%20this%20particular%20question.%3CBR%20%2F%3E%3CBR%20%2F%3EI'll%20bet%20the%20problem%20has%20to%20do%20with%20VLOOKUP%2C%20not%20EXP.%20Simply%20extract%20the%20VLOOKUP%20part%20into%20a%20separate%20cell%20to%20confirm.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20think%20your%20last%20VLOOKUP%20parameter%20is%20zero%20(FALSE).%20So%20you%20are%20looking%20for%20an%20exact%20match.%20And%20VLOOKUP%20fails%20to%20find%20one.%20That%20should%20be%20easy%20to%20confirm%20with%20MATCH.%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20the%20lookup%20value%20(C8%20%3F)%20is%20numeric%2C%20the%20problem%20might%20be%20that%20C8%20and%2For%20the%20values%20in%20A6%3AA20%20(%3F)%20are%20calculated%2C%20and%20their%20__binary__%20values%20do%20not%20match.%20That%20could%20be%20confirmed%20with%20MATCH(C8%2C%20Ax%2C%200).%20Caution%3A%20C8%3DAx%20might%20return%20true%20if%20their%20values%20rounded%20to%2015%20significant%20digits%20match.%3CBR%20%2F%3E%3CBR%20%2F%3EBeyond%20that%2C%20we%20cannot%20say%20what%20is%20happening%20unless%3A%20(a)%20you%20provide%20an%20Excel%20file%20that%20demonstrates%20the%20problem%3A%20or%20(b)%20you%20display%20all%20calculated%20values%20formatted%20as%20Number%20with%2015%20significant%20digits.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2437809%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20with%20Excel%20EXP%20formula%20with%20Vlookup%20and%20IF%20function%20spitting%20%23N%2FA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2437809%22%20slang%3D%22en-US%22%3Ethank%20you%20so%20much%20for%20your%20help%2C%20I've%20tried%20it%20and%20it's%20definitely%20a%20Vlookup%20issue%2C%20but%20I'm%20not%20sure%20how%20to%20fix%20it.%20I%20have%20the%20excel%20document%20and%20I%20marked%20the%20area%20where%20it%20goes%20wrong%2C%20but%20not%20sure%20how%20to%20attach%20it%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2437810%22%20slang%3D%22en-US%22%3ERe%3A%20Help%20with%20Excel%20EXP%20formula%20with%20Vlookup%20and%20IF%20function%20spitting%20%23N%2FA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2437810%22%20slang%3D%22en-US%22%3Ejust%20attached%20it%20to%20the%20original%20post!%3C%2FLINGO-BODY%3E
Occasional Contributor

I am trying to calculate a formula using EXP( ), in it, I use the IF function and the Vlookup function. I have tried it in different ways and I think the issue lies within the VLookup function. I have the dates available within the range of my VLookup in the other sheet (Input Market Data (2) ), but somehow it keeps spitting out #N/A. 

In the images, the column of dates is from "Input Market Data (2)" and the Formula is the one that keeps spitting out #N/A

Screen Shot 2021-06-11 at 9.41.18 AM.png

Screen Shot 2021-06-11 at 9.41.09 AM.png

  

7 Replies

The image is really too small for my tired eyes, and too blurry when I try to enlarge it. It is always better to attach an Excel file, not an image. And that is probably even more true for this particular question.

I'll bet the problem has to do with VLOOKUP, not EXP. Simply extract the VLOOKUP part into a separate cell to confirm.

I think your last VLOOKUP parameter is zero (FALSE). So you are looking for an exact match. And VLOOKUP fails to find one. That should be easy to confirm.

If the lookup value (C8 ?) is numeric, the problem might be that C8 and/or the values in A6:A20 (?) are calculated, and their __binary__ values do not match. That could be confirmed with MATCH(C8, Ax, 0). Caution: C8=Ax might return true if their values rounded to 15 significant digits match.

 

Alternatively, what appears to be numeric might, in fact, be text.  Looks can be deceiving; and the format of the cells does not matter.  Use the ISTEXT or ISNUMBER function to confirm.

Beyond that, we cannot say what is happening unless: (a) you provide an Excel file that demonstrates the problem: or (b) you display all calculated values formatted as Number with 15 significant digits.  But even the latter might not be sufficient.

thank you so much for your help, I've tried it and it's definitely a Vlookup issue, but I'm not sure how to fix it. I have the excel document and I marked the area where it goes wrong, but not sure how to attach it
just attached it to the original post!

@CocoZhou You need to change the lookup range so that the first column holds the values you would like to find a match for. So, in E8, change the formula to:

 

=VLOOKUP($C8,'Input market data IR (2)'!$B$6:$L$60,9,0)

 

Similar for the formulae in F and G. Start the lookup range in column B and decrease the column count by 1.

best response confirmed by CocoZhou (Occasional Contributor)
Solution

@Riny_van_Eekelen  wrote: ``change the formula to
=VLOOKUP($C8,'Input market data IR (2)'!$B$6:$L$60,9,0)
Start the lookup range in column B and decrease the column count by 1``

 

I agree with Riny insofar as changing the lookup column to B instead of A.

 

But the additional adjustment to the formula in G8 is more than merely decreasing the column offset by 1.

 

I think it would be easier to understand and maintain if you change the formulas to use an INDEX/MATCH paradigm.  Specifically:

 

E8:

=INDEX('Input market data IR (2)'!$J$6:$J$60,
MATCH($C8,'Input market data IR (2)'!$B$6:$B$60,0))

 

F8:

=INDEX('Input market data IR (2)'!$K$6:$K$60,
MATCH($C8,'Input market data IR (2)'!$B$6:$B$60,0))

 

G8:

=IF($A8<$C$5,0,EXP(-$B8*(E8+($B8
-INDEX('Input market data IR (2)'!$I$6:$I$60,
MATCH($C8,'Input market data IR (2)'!$B$6:$B$60,0)))*F8)))

 

But note that you still get #N/A errors in row 82 because C82 is 12/31/2023 instead of 12/1/2023.

 

You might fix C82.

 

But I wonder if you really want MATCH(...,...,1) instead of MATCH(...,...,0).

 

The change presumes that the dates in B6:B60 are in ascending order.  That is true for the Excel file that you posted.  Only you can say whether we can depend on that.

 

 

thank you so much, this was very helpful!