MHB How can I get equal columns and rows from a total?

  • Thread starter Thread starter SLSCoder
  • Start date Start date
  • Tags Tags
    Columns
Click For Summary
To determine the number of equal columns and rows from a variable total of cells, the calculation involves using the floor function on the square root of the variable x. For example, if x equals 10, the result is 3 columns and 4 rows, with the last row containing only one value. The formula effectively helps in organizing the cells into a grid format. This method ensures that the layout remains balanced while accommodating the total number of cells. Understanding this calculation is essential for efficient data presentation.
SLSCoder
Messages
4
Reaction score
0
I have a number of cells (say 10 cells) but that number is a variable.
I have the value of the variable but it's not a 'hard' number. We'll call the variable x.

I need to calculate how many columns I'll have if the columns and rows will be the same, or the columns will be 1 minus (floor) the number of rows.
If the variable x = 10 then the columns would be 3 and there would be 4 rows, the last row would only have a value in the first column.

How can I calculate for the number of columns I need given the variable x?
 
Mathematics news on Phys.org
Duh - floor(square root of x)