If you consider the tilemap rows/columns as "world coordinates" then you can use a simple formula to convert x and y values to tilemap rows and columns:
``` lang-none
Tile_Column = X / Tile_Size
Tile_Row = Y / Tile_Size
```
Note that the division operations should be using integers to automatically round the answer down for you. If you're using real value types you need to use math.floor().

For screen to world coordinates, you first have to define where the screen is in the world:
``` lang-none
View_X: The X position of the screen's top-left corner in world coordinates.
View_Y: The Y position of the screen's top-right corner in world coordinates.
```
Then you can convert on-screen coordinates to world coordinates (i.e: for a mouse click) with the following formula:
``` lang-none
World_X = View_X + Screen_X
World_Y = View_Y + Screen_Y
```
Finally, you can take the ```World_X``` and ```World_Y``` values and put them into the first formula to get which tilemap column/row the coordinate is inside.