You want to try out this?
SELECT
Columna,
Columnb,
Columnc,
CASE
WHEN (SELECT SUM(*) FROM YOURTABLE WHERE Columnb between 1 and Columnb - 1) < 6000 THEN Columnc
ELSE (SELECT 6000 - SUM(*) FROM YOURTABLE WHERE Columnb between 1 and Columnb - 1)
END AS Columnd
FROM YOURTABLE;