Question: In a previous assignment, Excel wrote a Macro for you by recording your actions. The language the Macro was written in was Visual Basic, or

 In a previous assignment, Excel wrote a Macro for you by

In a previous assignment, Excel wrote a Macro for you by recording your actions. The language the Macro was written in was Visual Basic, or VBA. You can use VBA to program functions or subroutines for yourself. In this exercise you are to an interpolation function in VBA. You will need to have the "Developer" tab appearing on your ribbon. If it's not there, find "Options" under File or Home, click on "Customize Ribbon" and activate "Developer".

Make a yield curve by interpolating and extrapolating from four given terms and yields. make a table of values on a spreadsheet as shown below, but with the following terms and yields:

TermYield16.00%1.58.50%35.50%510.50%

In a previous assignment, Excel wrote a Macro for you by recording your actions. The language the Macro was written in was Visual Basic, or VBA. You can use VBA to program functions or subroutines for yourself. In this exercise you are to make an interpolation function in VBA. You will need to have the "Developer" tab appearing on your ribbon. If it's not there, find "Options" under File or Home, click on "Customize Ribbon" and activate "Developer".

Make a yield curve by interpolating and extrapolating from four given terms and yields. Cmake a table of values on a spreadsheet as shown below, but with the following terms and yields:

TermYield16.00%1.58.50%35.50%510.50%

make a straight-line interpolation function in VBA called, FInterp(x, xarray, yarray), that takes as input an array of x values, an array of their matching y values, and the x value for which you want it to interpolate/extrapolate a y value. Instructions for doing this arehere.

make a new table with column headings

TermInterpolatedVlookup trueVlookup false

Under "Term", make a column of terms running from 0 to 6.0 by increments of 0.2. In the "Interpolated" column, for each term, call your FInterp to interpolate/extrapolate the yield for that term (If your sheet appears like the one above, the xarray input for the interpolator is $B$5:$B$8, while the yarray is $C$5:$C$8).

For comparison, also find what the "vlookup" function produces. In the column beside your "Interpolated" column, use vlookup on the table $B$5:$C$8 for each term, with the optional 4th argument, "Range_lookup", set to "TRUE" to have vlookup provide the closest match. In the last column, again use vlookup, but with "Range_lookup" set to "FALSE" so that it returns #N/A if there is no exact match. (note: with vlookup set to false, vlookup may return #N/A even for terms of 3 and 5. The failure to find a match is due to unseen numerical errors somewhere around the 16th decimal place of the value in the "Term" column. Your solution will be accepted even with the #N/As).

(a)What value does your interpolator return for a term of 2.0?(b)What value does your interpolator return for a term of 0.6?

Problem #3(a):

Answer as a real number

correct to4 decimals

Problem #3(b):

Answer as a real number

correct to4 decimals

recording your actions. The language the Macro was written in was Visual

In a minus aaacignozlool. Eml wrol: a Monro for you by moorrling your aoooa. Th: languag: Il:|: Maoro was no'ill:o in was 1u'iaual Basic. or REA. You can In: FHA. to program Functions or subrounra I'or youra:lf_ ln Ilo'a :Ioroial: you ar: lo 1.Irril:: an J'ntu'polalion fonelion in 10.I'liu|5|..'ll'ou will nood to hay: do: \"D:y:lop:r\" lal'J appoarlog on your ribbon. 1f il'5 not lint. nrl \"Worm\" unrlrr I'll: or Homo. :liok on \"Cutondz: Ribbon" and arrival: \"D:y1:lop:r"- Met: a yi:lrl Iota-Ir: by :intpolating andutrapolang from four giym IEITIEIE aridyiolda. Ctr-:at: a Lal:Il: of volume on a apruadalla: shown holow. bol will: Iii: following lonna and yi:ld5: Term Yield 1 6.011% 15 350% 3 550% 5 mm J _ n I l: D i i 3 l- l'rn \"I\" E 1 oor vain:- {i 1.5 tyour III-ahea- L 3 want "Ll-l" L 3 ll-our Hahn:- I lel: a an'alghl-rm inl:rj:rolar.ion function in VHA :all:d. Flntu'ox. :uuray. yarray}. IIl'IEI tailor: or inpol an array of: valuos. an array of'ioirmarehing y yalu:a_ and lb: :r valo: for which you waol it to outmpolaw'ulrapolat: ay valo:. loan-notions for doing ll'uia ar:l1:_r:. nal: :1 om.r lab]: will: oolumo hoarlioga '1'th lnt:rp-ol.al:rl 1I.I'loonlru|r Ira: 1'rI'ioolrop fala: Uri-Elm \"Tmn".rn':at: aoolornn oftcrona running oo: [I In ELI by ill-amt: of. In Th: \"'lolorpola'hod" column. lor :aoh t::|111. oall your Fln'tu'p lo oatmpolalraroxlrapolal: lh: yiolrl for Illal lonn {11? your shoot appoara Iii: III: on: aboy:. Tl}: IH'I'EjI' input I'or do: :int:rp-olatuor ia Ez. wlu'l: Tl}: yarray is SEES-{:53}. For comparison. also nd Iwhat Ill: \"rloolrup\" funolion pro-donor- Io ll]: :ohnnn braid: yonr\"Iol:rpolat:rI\"' oolurno. or: yloolm]: on Ill: lalJl: 5355:5533 I'or :arh mm}, wilh lil'l: optional 1\"1': argommt. \"Hangmloolmp\". a:l to 'TEUE" Io hay: yloolwp gravid: Ill: :loaost match- In Il:|: last :olurnn. again no: yloolrlrp. but wilh \"RangoJo-olmp" and lo \"FALSE' 5: 1i'lat ll roturna #NM. il Ilia: is no :Iarl maloh. {not:: will: ylooku]: ant to falao. rlo-okn]: mnyrorumi-Um fortunaoll midi-3111: fallln': loniamalol: :iarlol: louoaom nuoaorloalmora 5on1:wl1:r: around Ill: 15d! rluoiozlal plan: of Ill: yaln: in Tl}: \"Torin" column. Your solution will 1:: are-:olod oroo with 11:: FEMS]- {a} Whal 1.u'al'LII: rlo:5 yoln' iolorpolanr r:tl.rrn fora t:1111 oflll'l' [ll] Whal 1.u'allll: rlooa your iolorpolator r:tl.rrn fora t:1111 ofll'l' lI Answer as a real number correct to 4 dad male I.__...__ __ _ ___I _.._I___

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!