Shortest Formula Challenge #1: Material Gains 14

The challenge this week is as follows: given a random – though legal. according to the laws of the game – position on a standard chessboard, here occupying the range A1:H8, a single formula to give the material evaluation of the position. For example, on the board below:


the result of the formula would be -3.


Each piece scores the following:

P (Pawn): 1
N (Knight): 3
B (Bishop): 3
R (Rook): 5
Q (Queen): 9

Each side will always have one King each, though other material may vary.

The prefixes “W” and “B” indicate a White piece and a Black piece respectively.

The formula result is the material evaluation from White’s perspective. Hence, if White’s material total is greater than Black’s, this result should be positive; conversely, if White’s material total is less than Black’s, this result should be negative. And if material is equal, the result should be zero.

This week’s challenge is also a shortest formula challenge, which means that readers should attempt to find not only a correct solution to the problem but also one which has the least number of characters as possible.

Formulas must reference the range A1:H8 – no other range references are permitted, including Named Ranges.

Solution next week. Best of luck!


  1. Nominally 1, though, as I said, both sides will always have precisely one king each, so this piece cannot ever affect the material balance.

  2. Alright short or not here is my solution:


    Entered as an array from White’s perspective.

  3. Hi XOR LX

    This will be short…. i suppose ;-)))



  4. @GreasySpot

    Good stuff! Works perfectly! Now let’s just see if anyone can come along with a shorter version.

    Thanks a lot for your contribution. Cheers

  5. @Bill Szysz

    Hi Bill. Not sure I understand. How does this formula account for the possible different number of pieces that Black and White have?


  6. I feel a bit of a cheapskate offering this as the donkeywork has already been done by Bill. However given the prize money that’s at stake, it has to be done…….


    Would I be pushing my luck to suggest using lowercase letters and transposing the arrays so that commas outnumber the semicolons?


    Although it contains the same number of characters it is actually ‘shorter ‘, left to right and will use up less ink!!!

  7. Looks like my (Bill’s if we’re being honest. What’s a couple of $’s between friends?) formulas have fallen foul of your editor?

    *First visit to site. Looks interesting, I will be back!!!

  8. @Snakehips

    Welcome! Good to see someone of such standing in the Excel world here! (No offence, everyone else 🙂 )

    “Harsh” is the word that springs to mind! But then, Bill did kind of leave that door wide open, so who can blame you for walking through it?

    As for the lower-case stuff, you should know me better than that! So that one’s not getting you any extra points, I’m afraid. And prize money?? You and everyone else wish! 🙂

    Cheers and hope to see you around here again!

    P.S. Sorry about the editor here. Not nearly on the same level of technical expertise as at Mr. Excel. Have amended your formula, hopefully to what you intended.

  9. Pingback: Shortest Formula Challenge #1: Results and Discussion | EXCELXOR

  10. Pingback: Video 00162 Excel Formula Calculates Value of Chess Pieces | My Spreadsheet Lab

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.