Auto-calculating x,y screen coordinates for a graphic user interface need

Gewy

New Member
Joined
Dec 19, 2021
Messages
2
Office Version
  1. 365
Platform
  1. MacOS
Hello!

I am in need of help building a calculator / formula in order to locate the x,y coordinates of graphics that will display on a screen interface. The graphics I will be placing require the upper left corner coordinates (i.e. where the graphic image begins).

The interface element is a popup within a larger screen, and can contain anywhere from 1 to 25 individual icons, placed in a series of rows. There is a maximum of 5 rows possible, therefore a maximum of 5 icons per row. Example, if there are 16 icons required, there would be 4 rows of icons - 3 full rows of icons and 1 row containing only 1 icon. If there were only 3 icons, there would be only one single row centered on the screen. All rows are required to be centered onscreen, i.e. - a row of 5 would appear wider than a row of 4 below it in the case of 9 icons.

Each icon carries the same dimensions (92 pixels wide x 66 pixels high).

The overall screen width is 800 pixels wide x 530 pixels high.

I am looking to develop a formula that can tell me what the x,y coordinates of each icon would be, based on the number of icons required in the particular popup.

I appreciate any insight into how best to approach this. I have created some formulas but none take into account how it would work beyond a single row. Thats where I am getting stuck.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi Gewy,

Is this what yr trying to achieve?

Book1
ABCDEF
2Width92
3Height66
4
5193185277369
6112345
767678910
81331112131415
91991617181920
102652122232425
11
12Icons12
13XY
14Position111
152931
1631851
1742771
1853691
196167
2079367
21818567
22927767
231036967
24111133
251293133
Sheet1
Cell Formulas
RangeFormula
C5:F5C5=B5+$B$2
A7:A10A7=A6+$B$3
B14:B25B14=IF(ROWS($B$14:B14)>$B$12,"",ROWS($B$14:B14))
C14:C25C14=IF(B14="","",SUMPRODUCT(($B$6:$F$10=B14)*$B$5:$F$5))
D14:D25D14=IF(B14="","",SUMPRODUCT(($B$6:$F$10=B14)*$A$6:$A$10))
 
Upvote 0
Solution
Hello!

I am in need of help building a calculator / formula in order to locate the x,y coordinates of graphics that will display on a screen interface. The graphics I will be placing require the upper left corner coordinates (i.e. where the graphic image begins).

The interface element is a popup within a larger screen, and can contain anywhere from 1 to 25 individual icons, placed in a series of rows. There is a maximum of 5 rows possible, therefore a maximum of 5 icons per row. Example, if there are 16 icons required, there would be 4 rows of icons - 3 full rows of icons and 1 row containing only 1 icon. If there were only 3 icons, there would be only one single row centered on the screen. All rows are required to be centered onscreen, i.e. - a row of 5 would appear wider than a row of 4 below it in the case of 9 icons.

Each icon carries the same dimensions (92 pixels wide x 66 pixels high).

The overall screen width is 800 pixels wide x 530 pixels high.

I am looking to develop a formula that can tell me what the x,y coordinates of each icon would be, based on the number of icons required in the particular popup.

I appreciate any insight into how best to approach this. I have created some formulas but none take into account how it would work beyond a single row. Thats where I am getting stuck.

Hi Gewy,

Is this what yr trying to achieve?

Book1
ABCDEF
2Width92
3Height66
4
5193185277369
6112345
767678910
81331112131415
91991617181920
102652122232425
11
12Icons12
13XY
14Position111
152931
1631851
1742771
1853691
196167
2079367
21818567
22927767
231036967
24111133
251293133
Sheet1
Cell Formulas
RangeFormula
C5:F5C5=B5+$B$2
A7:A10A7=A6+$B$3
B14:B25B14=IF(ROWS($B$14:B14)>$B$12,"",ROWS($B$14:B14))
C14:C25C14=IF(B14="","",SUMPRODUCT(($B$6:$F$10=B14)*$B$5:$F$5))
D14:D25D14=IF(B14="","",SUMPRODUCT(($B$6:$F$10=B14)*$A$6:$A$10))
Thank you RasGhul! This gives me an idea of how to adapt it. I would need to center these graphics on a screen, so the position starting at 1 does not work for me, but I believe it's a relatively simple edit. Thanks again for your insight! Cheers
 
Upvote 0
Thanks for the feedback, so the position is the top left pixel of each icon but from center out?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top