yes, 7window, the height is 8/w²
Now, you have all three dimensions in terms of w.   Each surface of the box is a rectangle, and there are two surfaces of each particular surface area.   Apply the area of a rectangle formula 3 times, and double it.
It does turn out to be a function.  Constraints on w are that it is greater than zero.   And, taking the derivative of the function (next year in calculus) and setting it equal to zero gives the cubed root of 6 as the value of w which minimizes the surface area.   If you graph the function for SA, the lowest point on the curve with have an x-value of cubed root of 6.*
(no guarantees though; I don't have any paper next to me to write this out & double check my work.)