macro calculation