<p>Hi. I just have a quick question in regards to calculating the N50 for a list of contigs. Anybody know how to do it in excel, by any chance? I&#39;m not much of a programmer just yet, and I was just wondering if there was an easier way than just constructing a python program or something.</p>

<p>Thanks!</p>

Get the lengths of your contigs into a column, and sort that column. Sum over all lengths to get the total number bases N, and then just traverse your list of lengths from top to bottom until the cumulative sum reaches N/2. (You could use an additional column to keep track of the running sum if that makes it easier.)

The length of the contig where your running sum passes N/2 is the N50. (In the case where the running sum exactly equals N/2, then the N50 is the average of this length and the subsequent one in the list.)

For example, below, the cumulative sum exceeds 44/2=22 on a contig with length 6, so N50 = 6.

    contigs    length    cumulative sum
    AAAAAAA    7         7
    AAAAAA     6         13
    AAAAAA     6         19
    AAAAAA     6         25
    AAAA       4         29
    AAAA       4         33
    AAA        3         36
    AAA        3         39
    AA         2         41
    AA         2         43
    A          1         44