This paper outlines a method for determining the maximum number of floors of a vertical farm (VF) that can be powered by building-integrated solar photovoltaic panels for supplying artificial lighting to the plants. The panels are mounted on all the walls and the rooftop of the building. It takes into account the location of the site, the monthly average daily solar irradiation, parameters associated with the luminaires, the geometrical dimensions and orientation of the layout, the tilt angle and row spacing between the rooftop panels, and the efficiency of the conversion system. It then provides linear equations representing the year-round electricity demand of the luminaires and the yearly electric yield from the panels. These equations are solved simultaneously to estimate the maximum number of floors. The results show that design performance can be maximized by optimizing the floor dimensions, layout orientation, tilt angle, and row spacing. Hypothetical 300 m2 vertical farms, partially occupied by growing trays, located in Auckland and Dubai, were found to have maximum heights of 1.87 and 3.47 floors, respectively. A free online tool is also presented to help designers and researchers analyze designs located anywhere in the world.