Calculate the width of square dynamically based on columns and rows

%3CLINGO-SUB%20id%3D%22lingo-sub-1570350%22%20slang%3D%22en-US%22%3ECalculate%20the%20width%20of%20square%20dynamically%20based%20on%20columns%20and%20rows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1570350%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22lia-message-subject-wrapper%20lia-component-subject%20lia-component-message-view-widget-subject-with-options%22%3E%3CFONT%20face%3D%22inherit%22%3EI've%20been%20trying%20to%20create%20a%20formula%20which%20determines%20the%20size%20(Weighting)%20dynamically%20of%20the%20square%20based%20on%20the%20rows%20and%20columns%20and%20%3C%2FFONT%3Ehaven't%3CFONT%20face%3D%22inherit%22%3E%26nbsp%3Bhad%20any%20luck.%20Hope%20the%20images%20explain.%20Thanks!%3C%2FFONT%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1570350%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1571461%22%20slang%3D%22en-US%22%3ERe%3A%20Calculate%20the%20width%20of%20square%20dynamically%20based%20on%20columns%20and%20rows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1571461%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3BHi%20Sorry%20for%20the%20confusion!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAttached%20is%20better%20image%20I%20hope%20that%20explains%20things!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20small%20squares%20will%20have%20a%20standard%20weighting%20of%201.%20and%20then%20the%20larger%20ones%20will%20have%20a%20value%20consisting%20of%20how%20many%20squares%20would%20fit%20in%20it.%20i.e%20the%20weighting%204%20square%20could%20fit%204%20smaller%20squares%20in.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20listed%20how%20each%20column%20and%20row%20is%20used.%20Based%20on%20these%20i%20think%20a%20weighting%20could%20be%20calculated%20using%20a%20formula.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20think%20it%20would%20work%20similar%20to%3A%20find%20the%20difference%20between%20the%20columns%20and%20if%20it%20is%20not%201%20then%20the%20weight%20must%20be%20more%20than%201%20but%20then%20the%20rows%20come%20in%20to%20determine%20how%20big%20it%20is%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20that's%20clearer.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1570981%22%20slang%3D%22en-US%22%3ERe%3A%20Calculate%20the%20width%20of%20square%20dynamically%20based%20on%20columns%20and%20rows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1570981%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F732084%22%20target%3D%22_blank%22%3E%40jacksaxby%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWell%2C%20there%20is%20a%20saying%20that%20%22a%20picture%20is%20worth%20a%20thousand%20words%2C%22%20but%2C%20sadly%2C%20it's%20not%20always%20true.%20At%20least%20not%20when%20it%20comes%20to%20creating%20Excel%20formulas.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CU%3E%3CSTRONG%3EBetter%20would%20be%20words%20that%20explain%20with%20an%20example%20or%20two%20what%20you%20expect%20the%20result%20to%20be%20for%20several%20of%20those%20sets%20of%20figures.%3C%2FSTRONG%3E%3C%2FU%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere's%20also%20a%20bit%20of%20potential%20confusion%20(at%20least%20in%20my%20mind)%20around%20whether%20there's%20a%20distinction%20between%20size%20and%20weight.%20The%20way%20you%20write%2C%20%3CEM%3E%22%3C%2FEM%3E%3CFONT%20face%3D%22inherit%22%3E%3CEM%3Ea%20formula%20which%20determines%20the%20size%20(Weighting)%22%3C%2FEM%3E%20seems%20to%20equate%20weight--or%2C%20to%20be%20more%20precise%2C%20weight%3CFONT%20color%3D%22%23FF6600%22%3Eing%3C%2FFONT%3E--with%20size.%20%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22inherit%22%3ESome%20of%20the%20components%20in%20your%20image%20are%20not%20squares%20at%20all%2C%20but%20rather%20rectangles%20(%22squares%22%20per%20se%20being%20a%20subset%20of%20rectangles%2C%20of%20course)....%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22inherit%22%3ESo%20are%20you%20really%20looking%20for%20the%20size%20of%20squares%2C%20or%20the%20area%20of%20rectangles%3F%20or%20the%20sum%20of....%3F%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22inherit%22%3EI%20trust%20you%20see%20the%20potential%20confusion%20here%3A%20these%20observations%20and%20questions%20are%20all%20asked%20in%20good%20faith.%20I'd%20really%20like%20to%20help%2C%20but%2C%20no%2C%20those%20images%20just%20raised%20more%20questions%20than%20the%20resolved.%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor
I've been trying to create a formula which determines the size (Weighting) dynamically of the square based on the rows and columns and haven't had any luck. Hope the images explain. Thanks!
11 Replies
Highlighted

@jacksaxby 

 

Well, there is a saying that "a picture is worth a thousand words," but, sadly, it's not always true. At least not when it comes to creating Excel formulas.

 

Better would be words that explain with an example or two what you expect the result to be for several of those sets of figures.

 

There's also a bit of potential confusion (at least in my mind) around whether there's a distinction between size and weight. The way you write, "a formula which determines the size (Weighting)" seems to equate weight--or, to be more precise, weighting--with size.

 

Some of the components in your image are not squares at all, but rather rectangles ("squares" per se being a subset of rectangles, of course)....

 

So are you really looking for the size of squares, or the area of rectangles? or the sum of....?

 

I trust you see the potential confusion here: these observations and questions are all asked in good faith. I'd really like to help, but, no, those images just raised more questions than the resolved.

Highlighted

@mathetes Hi Sorry for the confusion!

 

Attached is better image I hope that explains things!

 

The small squares will have a standard weighting of 1. and then the larger ones will have a value consisting of how many squares would fit in it. i.e the weighting 4 square could fit 4 smaller squares in.

 

I've listed how each column and row is used. Based on these i think a weighting could be calculated using a formula. 

 

I think it would work similar to: find the difference between the columns and if it is not 1 then the weight must be more than 1 but then the rows come in to determine how big it is?

 

I hope that's clearer.

 

Many thanks!

 

 

Highlighted

@jacksaxby 

 

Sigh. I know it's clear to you. And I'm starting to see the pattern here. But, what's it all about?

 

What I don't see is what you're trying to get to, first, with the calculations themselves.

Then, in the bigger picture, what's the ultimate goal or objective?

 

It might help too to know what the larger context is for even trying to do this in the first place. Are you in school, either as a student or teacher?  Is this an assignment having to do with

  • how many two dimensional rectangle/squares of varying dimensions can be fitted into a square of X dimensions OR
  • how large a square will be needed to contain (with no wasted space) the maximum number of objects defined as.....
  • OR something else altogether.

Or are you an urban planner trying to figure out how many tables can be fit in a city square so the neighborhood restaurants can safely serve food to groups of varying sizes during the Covid-19 crisis?

Highlighted

@mathetes Hi Sorry that I'm not making this clear

 

Just trying to get the size of each box. without manually having to enter the weighting.#

 

Image attached. Currently i enter the size of each one and it is very time consuming!

Highlighted

@jacksaxby 

 

I'm sorry I'm so dense. We're clearly speaking past each other. I asked a short while ago for a worked out example. Here's the way I put it at the time, and the key there is "words that explain...what you expect the result to be"

Better would be words that explain with an example or two what you expect the result to be for several of those sets of figures.

 

You keep sending more images, which do nothing for me. (I'm a more verbal, text-driven animal, I guess).   To the point that I don't even understand (apparently) what you mean by "get the size of each box" if it's not just 1x1=1; 3x1=3; 5x1=5

If that's all it is, if you're really just asking how to do simple multiplication in Excel, then, in Column C, row 2, enter =A2*B2  and copy that formula and paste it in rows 3 through to the bottom row.

 

If, on the other hand, you're looking for something else, what is that "something else"? It might be just as simple as spelling out what the "weighting" is that you're currently entering manually. And where do you get it from? How does it differ from size, or is it the same thing. As I said earlier, you seem to be using size and weighting almost interchangeably.

 

If you have a spreadsheet going here, it actually would be helpful to post it rather than images. It would give me (or somebody else) a glimpse into what you're working with and what you've tried.

 

I apologize for being so dense. As I said, we seem to be speaking past each other, each of us thinking we're being clear.

Highlighted

@mathetes Hi

 

Yeah I have been using size/weighting interchangeably. So as you can see from the slots image. In the context the bigger games have a higher size value. The smaller squares have a base value of 1, these values have been input manually so far. We need to calculate the size value of each square using the columns and rows. There is 6 columns in this example so 6, 1 sized squares could fit on 1 row. a square than spans multiple columns is counted as 1 column but a larger weighting is assigned.

 

Attached another image, ive split it further. Thanks for the help!

 

I want to get the size of each. You can see that the 1st game starts on the 1st row at column 1, then the second game starts at column 3. this means that the size of game 1 will have a size of 2. However if the game spans 2 rows then this size will be 4. Thanks Again!

Highlighted

@jacksaxby 

 

Wait a minute here. Are you going FROM the images TO the numbers? TO the calculation?! Not the other way around?

 

Your raw material is the image? It wasn't a way to illustrate what you were tying to accomplish with the formulas, but a way to get to the numbers?

 

No wonder we weren't speaking the same language.  I was totally reading all of this as CREATING the squares and rectangles from the numbers in Excel's various columns.

 

I have no idea how to take a set of images (or one image with multiple rectangles and squares) and convert that into the row and column data you're asking for, thence to predict that weighting. Sorry. The other way around, yes, maybe we could talk.

 

If those images are discrete images, then it might be possible to extract pixel counts of length and width and start doing some things with that data, but that aside, I am afraid I don't know what you could do other than enter the numbers you've been entering, with whatever the heuristic is that you've developed to develop those numbers consistently. You need quantitative data of some kind to begin with; pure images, without some way to measure them via the computer...would not work. If you could take that image and get pixel counts for the horizontal and vertical axes, maybe that could serve as a starting point, but you'd still have to enter (Manually) how many images there are in each horizontal and vertical section....

 

Maybe there's somebody else out there, another expert in Excel, who knows a bit more about image manipulation, who can help. I like to think that at least I helped us get to the bottom of the confusion.

 

Best wishes.

Highlighted

@mathetes Hi, I manually input the correct row and column the images are on. its just using a formula on the rows and columns to get the size of it.

 

For instance.  =IF((A3-A2)>1,A3-A2,1)  gets me the correct columns but does not account for the size of the games that span multiple rows

Highlighted

@jacksaxby 

 

Since nobody else has chimed in (yet), I'll give it another try. I still need to give you a more clear explanation to someone who's not inside your head. You know what you're saying, what you're doing. It's still not clear to me.

 

I've asked before, and I'll ask once more:

 

Walk me through how you'd do those calculations that you want if you were NOT trying to write it in Excel. That's what I meant in one of my earlier messages when I asked you to walk through a complete example for (I said then several rows because I was going the other direction) ..

So now, I'm asking that you walk through .for several images and spell out what you're doing to get the numbers you are looking for. Don't talk about rows and columns; talk about numbers and where you get them from, what you do with them, how you get the size/weight from those.

 

Maybe another way to say it: if you were back in school working this out on a blackboard (or whiteboard), how would you do it and explain it to the others in the class?

Highlighted

@mathetes 

 

 

 

Attached is an excel format. hopefully this better explains it.

 

Thanks for trying

Highlighted

@jacksaxby 

 

I've given you a few thoughts on the attached. But bottom line, I'm not sure that this can be done dynamically, as your original request seems to be seeking. I'd be delighted to see others chime in with suggestions.......

 

Are you really doing this with the kinds of images you've shown? Why is it important? Part of some game?