Using X,Y coords to assign grid area

Wolfmanfafa

New Member
Joined
Nov 22, 2017
Messages
6
I have a list of x and y values for a 600x600 coordinate plane. I want the plane divided up into 9 equal grids (200x200). Is there a formula to return which grid the x,y coordinate exists in? As of now, I think I can do it using several IF AND formulas in multiple cells. (ie.
IF (A2>0 AND A2<201,”zone 1”)
IF (A2>200 AND A2<401,”zone 2”)

Then do another one for B (y value) in a different column.
Then write a formula where it uses both values to determine which grid it’s in.

I’d like to do it with one simple formula if possible.

Thanks in advance!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Book1
ABC
1xyzone
21200zone 1
3201150zone 2
4567199zone 3
555201zone 4
Sheet4
Cell Formulas
RangeFormula
C2="zone "&INT(($A2-1)/200)+INT(($B2-1)/200)*3+1


Something like that?

WBD
 
Upvote 0
Wow!! That is amazing! I would’ve never come up with that. Thank you so much. And what a fast response.

That will work perfect!
I am guessing that the /200 would make it difficult to subdivide these zones into blocks of 50. Is there an easy way to accomplish that? If not, don’t trouble yourself. I already greatly appreciate the swift and awesome answer.
Also, If the cells are blank it returns “zone -3”. I can always jest delete blankncells but just curious if there is an easy way to correct that like putting the formula into an IF, THEN statement to only use numbers that return as positive?

Thanks again! You were super helpful!
 
Upvote 0
Code:
=IF(AND($A2>=1,$A2<=600,$B2>=1,$B2<=600),"zone "&INT(($A2-1)/200)+INT(($B2-1)/200)*3+1,"")

That will ensure the coordinates are in the right range. Not sure what you mean about sub-dividing into 50s.

WBD
 
Upvote 0
Let me explain to you my overall plan. I have a 600x600 grid in a game. The grid is filled with resource islands and player’s bases.

I’ve entered in 250 coordinates of high level resource islands throughout the grid.

With your help (thank you), I currently have everything divided into 200x200 zones.

Instead of subdividing into 50x50 blocks, the plan is to enter your coordinates and select a radius from that coordinate and have it only show those mines and bases within the specified range of your coordinates. (The resource islands are fixed but you can move your base.) I am making something for my team so they can enter their coordinates and get all the abandoned bases and high level mines that are near them.

I also created a scatter plot. The mines are blue dots. Once I create the table of abandoned bases, I’d like those to show up on the same scatter plot in red.

I haven’t had a chance to get to the last part yet. I’m doing it in phases as I have time.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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