http://www.wowwiki.com/World_of_Warc...Raid_Functions
local name, rank, subgroup, level, class, fileName, zone, online = GetRaidRosterInfo(Raid_Member_ID_Number);
Will return the subgroup number the player is in.
There's a UnitInParty(UnitID) function, but I don't know if it works for raid members or just your subgroup.