Need help in convert code Microsoft Excel sqlserver code

  • Please help convert equation in Excel to SQL

    =IF(DATE(YEAR(TODAY());MONTH(B2);DAY(B2))>TODAY();DATE(YEAR(TODAY())-1;MONTH(B2);DAY(B2));DATE(YEAR(TODAY());MONTH(B2);DAY(B2)))

    =ROUNDDOWN((((1+B4)^YEARFRAC(B2;B3))-1)*B1;2)

  • and what is the sql you tried so far?

    All functions you mention from excel can accurately be done in SQL with a possible exception of yearfrac - as The YEARFRAC function may return an incorrect result when using the US (NASD) 30/360 basis, and the start_date is the last day in February. - and this is the basis you are using on your example.

    And do supply DDL to create table, sample data (through insert statements) and desired output on a consumable format

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply