ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calculate No. of Objects on Floor Plan (https://www.excelbanter.com/excel-programming/274845-calculate-no-objects-floor-plan.html)

Simon[_6_]

Calculate No. of Objects on Floor Plan
 
I would like to calculate how many books of various
dimensions (only Length and Width - not Depth) will fit
onto a given floor plan of a box.

So the input is two dimensions - Length and Width.
The ouput is the number of books that will fit on the
floor plan with no overlaping.

does anyone know how to go about starting this?

Many Thanks,


Simon

Dick Kusleika

Calculate No. of Objects on Floor Plan
 
Simon

Try this

Function BooksInBox(L As Long, W As Long) As Long

Dim BoxL As Long 'always =BoxW
Dim BoxW As Long 'always <=BoxL
Dim NumBooks As Long, NumBooks2 As Long
Dim RemBox As Long


BoxL = 50
BoxW = 40

'Test lenghtwise
NumBooks = (BoxL \ L) * (BoxW \ W)
RemBox = BoxL - ((BoxL \ L) * L)
NumBooks = NumBooks + ((RemBox \ W) * (BoxW \ L))

'Test widthwise
NumBooks2 = (BoxL \ W) * (BoxW \ L)
RemBox = BoxL - ((BoxL \ W) * W)
NumBooks2 = NumBooks2 + ((RemBox \ L) * (BoxW \ L))

BooksInBox = Application.Max(NumBooks, NumBooks2)

End Function

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Simon" wrote in message
...
I would like to calculate how many books of various
dimensions (only Length and Width - not Depth) will fit
onto a given floor plan of a box.

So the input is two dimensions - Length and Width.
The ouput is the number of books that will fit on the
floor plan with no overlaping.

does anyone know how to go about starting this?

Many Thanks,


Simon





All times are GMT +1. The time now is 05:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com