title: Incrementing ID again from last row google apps script
body: <p>last week I asked something here <a href="https://stackoverflow.com/questions/64680059/increment-id-from-last-row-google-apps-script">Increment ID from last row google apps script</a></p>
  <p>Everything was working well but then again, when I used WP1-1000 as a starting row, the result is still appearing as  WP1-0NaN</p>
  <pre><code>var riskid = mysheet.getRange(rlast,2).getValue();
    if (riskid.length &gt; 3){
      // Extract number ex. 3
      var riskidnb = parseInt(riskid.substring(1,riskid.length));
      // Increase risk number +1
      riskidnb++
      // Convert to string &quot;0004&quot;
      var s = &quot;000&quot; + riskidnb.toString();
      // Write risk nb i.e. &quot;R004&quot;
      mysheet.getRange(r,2).setValue(&quot;WP1-&quot;+ s.substring(s.length-4))
    }
  </code></pre>
  <p>I tried changing/increasing/decreasing the <strong>riskid.length</strong>, <strong>var s</strong>, and <strong>s.length-4</strong> from the code but still no avail. The result still appears as &quot;WP1-0NaN&quot;</p>
  <p>From my question, the string is already inverted into an integer, but it still appears as NaN when I changed it to WP1.</p>
  <p>Also, it seems the code from my last question only workds if there is only 1 letter like in the solution.</p>
  <p>I literally tried everything for 2 hours and going mad now.</p>