As Gauss pointed out, there is a formulaic approach to calculating CR. However, bear in mind that many players optimize their characters and are capable of stomping on most CR-appropriate encounters. So, as a GM you must be ready to up the ante a bit to keep things interesting. For such situations, it is easy to throw in "mooks" (very low CR critters) along with a CR-appropriate encounter. Adding mooks in roll20 is very easy. Grab 1 mook token and make a journal entry for it with HP, AC, CMD, and macros (abilities or Token Actions) for Melee, Saves and anything else you think appropriate. This will be your macro mook. Then just populate the map with additional mook tokens with only HP assigned. Use your macro mook for all mook rolls. This allows the use of CR-appropriate encounters while adding complexity and the importance of thinking strategically. This is my style. Your style may vary.