You're likely thinking of How I Met Your Mother, Season 1, Episode "The Slutty Pumpkin." Barney shows Ted, Marshall, and Lily his "slutty pumpkin" filing system (categorizing women he's dated). He never shows it to Andy on The Andy Griffith Show—Barney isn't in that series.