I found this function while browsing the WoWAce forums. I believe the credit goes to Phanx, but I don't think the post explicitly stated that she wrote it.
Lua Code:
local function numformat(num)
if not num then return 0 end
if abs(num) < 1000 then return num end
local neg = num < 0 and "-" or ""
local left, mid, right = tostring(abs(num)):match("^([^%d]*%d)(%d*)(.-)$")
return ("%s%s%s%s"):format(neg, left, mid:reverse():gsub("(%d%d%d)", "%1,"):reverse(), right)
end
Only works for whole numbers apparently.