Converting "Select ... Case" to "If" format

  • The below VBA code scores supplier, based on its response time, please your help to convert it to "IF" function format.


    Thank you

  • Code
    If Today() - Completed_Date <= 7 then
         Score = 4
    elseif Today() - Completed_Date > 7 and Today() - Completed_Date <= 14 then
         Score = 3
    elseif Today() - Completed_Date > 14 and Today() - Completed_Date <= 21 then
         Score = 2
    elseif Today() - Completed_Date > 21 then
         Score = 1
    end if
  • Assuming Row 1 is a header row and column J contains the "Completed Dates", try this in row 2 of the column where you want the results and copy down


    =IF(TODAY()-J2<=7,4,IF(TODAY()-J2<=14,3,IF(TODAY()-J2<=21,2,1)))


    Change each "J" in the formula to your actual "Completed Dates" column.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • You're welcome

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!