Skip to content

Instantly share code, notes, and snippets.

@pauldwhitman
pauldwhitman / excelStampDutyTasmaniaAustralia-letterOfTheLaw
Last active November 20, 2016 10:56
Microsoft Excel formula for calculating stamp duty in Tasmania (TAS), Australia. This formula follows the letter of the law. The output of this formula doesn't match the official calculator, because their calculator only "rounds" the input to the nearest $100. I cannot tell from the Tasmanian SRO website whether they do this when calculating act…
=
IF(A1 > 725000, 27810 + 0.045 * (A1 - 725000),
IF(A1 > 375000, 12935 + 0.0425 * (A1 - 375000),
IF(A1 > 200000, 5935 + 0.04 * (A1 - 200000),
IF(A1 > 75000, 1560 + 0.035 * (A1 - 75000),
IF(A1 > 25000, 435 + 0.0225 * (A1 - 25000),
IF(A1 > 3000, 50 + 0.0175 * (A1 - 3000),
50)
)))))
@pauldwhitman
pauldwhitman / excelStampDutyNorthernTerritoryAustralia
Last active January 29, 2017 05:53
Microsoft Excel formula for calculating stamp duty in Northern Territory (NT), Australia. They have a curious way of calculating stamp duty below $525,000. Their stamp duty calculator rounds to the nearest 5 cents, so I do too with MROUND().
=MROUND(
IF(A1 > 3000000 , 0.0545 * A1,
IF(A1 > 525000 , 0.0495 * A1,
0.06571441 * (((A1/1000)^2)) + 15 * (A1/1000)))
,0.05)
@pauldwhitman
pauldwhitman / excelStampDutySouthAustralia
Last active November 20, 2016 03:48
Microsoft Excel formula for calculating stamp duty in South Australia (SA), Australia.
=
IF(A1 >= 500000 , 21330 + 0.055 * (A1 - 500000),
IF(A1 >= 300000 , 11330 + 0.05 * (A1 - 300000),
IF(A1 >= 250000 , 8955 + 0.0475 * (A1 - 250000),
IF(A1 >= 200000 , 6830 + 0.0425 * (A1 - 200000),
IF(A1 >= 100000 , 2830 + 0.04 * (A1 - 100000),
IF(A1 >= 50000 , 1080 + 0.035 * (A1 - 50000),
IF(A1 >= 30000 , 480 + 0.03 * (A1 - 30000),
IF(A1 >= 12000 , 120 + 0.02 * (A1 - 12000),
0.01 * A1)
@pauldwhitman
pauldwhitman / excelStampDutyQueenslandAustralia-LongForm
Last active November 15, 2016 05:54
Microsoft Excel formula for calculating stamp duty in Queensland (QLD), Australia. Long form edition without any "magic numbers".
=ROUND(IF(A1>1000000,(75000-5000)*0.015+(540000-75000)*0.035+(1000000-540000)*0.045+0.0575*(A1-1000000),IF(A1>540000,(75000-5000)*0.015+(540000-75000)*0.035+0.045*(A1-540000),IF(A1>75000,(75000-5000)*0.015+0.035*(A1-75000),IF(A1>5000,0.015*(A1-5000),0)))),)
@pauldwhitman
pauldwhitman / excelStampDutyQueenslandAustralia
Last active November 20, 2016 03:42
Microsoft Excel formula for calculating stamp duty in Queensland (QLD), Australia.
=ROUND(
IF(A1 > 1000000 , 38025 + 0.0575 * (A1 - 1000000),
IF(A1 > 540000 , 17325 + 0.045 * (A1 - 540000),
IF(A1 > 75000 , 1050 + 0.035 * (A1 - 75000),
IF(A1 > 5000 , 0.015 * (A1 - 5000),
0))))
,)
@pauldwhitman
pauldwhitman / excelStampDutyNewSouthWalesAustralia-LongForm
Last active August 3, 2024 03:33
Microsoft Excel formula for calculating stamp duty in New South Wales (NSW), Australia. Long form edition without "magic numbers".
=ROUND(IF(A1>3000000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)+(0.045*(1000000-300000))))+(0.055*(3000000-1000000))+0.07*(A1-3000000),IF(A1>1000000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)+(0.045*(1000000-300000))))+0.055*(A1-1000000),IF(A1>300000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000)+(0.035*(300000-80000)))+0.045*(A1-300000),IF(A1>80000,(0.0125*14000)+(0.015*(30000-14000))+(0.0175*(80000-30000))+0.035*(A1-80000),IF(A1>30000,(0.0125*14000)+(0.015*(30000-14000))+0.0175*(A1-30000),IF(A1>14000,(0.0125*14000)+0.015*(A1-14000),A1*0.0125)))))),)
@pauldwhitman
pauldwhitman / excelStampDutyNewSouthWalesAustralia
Last active July 11, 2023 23:16
Microsoft Excel formula for calculating stamp duty in New South Wales (NSW), Australia.
=ROUND(
IF(A1 > 3000000 , 150490 + 0.07 * (A1 - 3000000),
IF(A1 > 1000000 , 40490 + 0.055 * (A1 - 1000000),
IF(A1 > 300000 , 8990 + 0.045 * (A1 - 300000),
IF(A1 > 80000 , 1290 + 0.035 * (A1 - 80000),
IF(A1 > 30000 , 415 + 0.0175 * (A1 - 30000),
IF(A1 > 14000 , 175 + 0.015 * (A1 - 14000),
0.0125 * A1))))))
,)
=ROUND(IF(A1>960000,A1*0.055,IF(A1>130001,(0.014*25000)+(0.024*(130000-25000))+(0.06*(A1-130000)),IF(A1>25001,(0.014*25000)+(0.024*(A1-25000)),A1*0.014))),)
=ROUND(
IF(A1 > 960000 , 0.055 * A1,
IF(A1 > 130001 , 2870 + ( 0.06 * (A1 - 130000)),
IF(A1 > 25001 , 350 + ( 0.024 * (A1 - 25000)),
0.014 * A1)
))
,)
@pauldwhitman
pauldwhitman / chessInCPart6-complete.c
Created March 14, 2013 11:36
Part of the "Chess in C" blog post series. The complete code for part 6.
#include <stdio.h>
#include <stdlib.h>
#define EMPTY 0
#define KING 1
#define QUEEN 2
#define ROOK 3
#define KNIGHT 4
#define BISHOP 5
#define PAWN 6
#define BREADCRUMB 9