If you are using a diamond shaped map (a la Age of Empires), this should work:
[pascal]
procedure MapToScreen(MapX, MapY: Double; out ScreenX, ScreenY: Integer);
begin
ScreenX := Trunc(32 *(MapY + MapX))- OffsetX;
ScreenY := Trunc(16 *(MapY - MapX))- OffsetY;
end;

procedure ScreenToMap(ScreenX, ScreenY: Integer; out MapX, MapY: Double);
var
t1, t2: Integer;
begin
t1 := ScreenX + OffsetX;
t2 := 2 *(ScreenY + OffsetY);
MapX := (t1 - t2)/ 64;
MapY := (t1 + t2)/ 64;
end;
[/pascal]
OffsetX and OffsetY indicate the position of the top-left corner of the screen relative to the origin of the map, which was considered to be the far left corner of the map. Each tile is considered to be 1 unit in each direction; with the x-axis running from the left corner to the top corner, and the y-axis running from the left to the bottom.

This code is for 64x32 pixel tiles; you would need to adjust things a little if you were using different sizes. The screen to map function was come up with by algebraically rearranging the map to screen function.

Also, these only work for flat maps; maps with a height component are more complicated as a click could have been in different tiles on different layers.