I wish I could say this was my idea. Somebody posted it on twitter awhile back and I did the classic “facepalm”. I have no idea how many times I manually picked apart the results of SQL Server’s SET STATISTICS IO ON without considering creating a formula to handle it for me. So, somebody came up with the brilliant idea to use a “computer” to complete a repetitive, mundane task. That person was not me. I only managed to remember to google how to do it (or as Matt Roche was fond of saying at the PASS Summit: “google it on Bing”).

A brief aside: am I the only one who feels like they have to say “SET STATISTICS IO ON” in a robot voice? Which then leads my stream of consciousness thinking to Short Circuit which of course leads me to mutter “Hey laser lips! Your mama was a snow blower!” This then completes my coworkers impression that I am completely unstable. And now back to our regular programming…

As far as I know all the credit for the stroke of brilliance to parse and sort SQL’s SET STATISTICS IO in Excel goes to Vicky Harp. You can find her post on how to do it over at her vickyharp.com.

Unfortunately, there were some minor typos with her original code that resulted in me just creating my own post so I could quickly find and use the formula’s myself:

Object Name =IFERROR(MID(A2,FIND("'",A2,1)+1,FIND("'",A2,FIND("'",A2,1)+1)-FIND("'",A2,1)-1),"") Scan Count =IF(LEN(A2)>0,IFERROR(MID(A2,FIND("Scan count",A2,1)+10,FIND(",",A2,1)-FIND("Scan count",A2,1)-10)+0,""),"") Logical Reads =IF(LEN(A2)>0,IFERROR(MID(A2,FIND("logical reads",A2,1)+13,FIND(",",A2,FIND("logical reads",A2,1))-FIND("logical reads",A2,1)-13)+0,""),"") Physical Reads =IF(LEN(A2)>0,IFERROR(MID(A2,FIND("physical reads",A2,1)+14,FIND(",",A2,FIND("physical reads",A2,1))-FIND("physical reads",A2,1)-14)+0,""),"") Read-ahead Reads =IF(LEN(A2)>0,IFERROR(MID(A2,FIND("read-ahead reads",A2,1)+16,FIND(",",A2,FIND("read-ahead reads",A2,1))-FIND("read-ahead reads",A2,1)-16)+0,""),"") LOB Logical Reads =IF(LEN(A2)>0,IFERROR(MID(A2,FIND("lob logical reads",A2,1)+17,FIND(",",A2,FIND("lob logical reads",A2,1))-FIND("lob logical reads",A2,1)-17)+0,""),"") LOB Physical Reads =IF(LEN(A2)>0,IFERROR(MID(A2,FIND("lob physical reads",A2,1)+18,FIND(",",A2,FIND("lob physical reads",A2,1))-FIND("lob physical reads",A2,1)-18)+0,""),"") LOB Read-ahead Reads =IF(LEN(A2)>0,IFERROR(MID(A2,FIND("lob read-ahead reads",A2,1)+20,FIND(".",A2,FIND("lob read-ahead reads",A2,1))-FIND("lob read-ahead reads",A2,1)-20)+0,""),"")

I’ve also attached an excel worksheet with the formulas already in it so if you want to be really lazy just download that from here: Statistics IO Parse Excel Sheet