If you eat, drink or use any part of a consumable item (food, drinks, medicines, cosmetics and similar goods) before you leave Japan, that item cannot pass the customs check (official pages call it "customs inspection" or "customs verification"), and the consumption tax on that item is not refunded. It also affects the other items on the same receipt (see below). The Japan Tourism Agency and Japan Customs both say this.
If you have already used some
Do not use the tax-free kiosk (officially the Tax Refund Kiosk, or tax-free procedure terminal) for these items. Tell a customs officer at the airport that the item has been used.
It affects the other items on the same receipt
The customs check is done receipt by receipt (a receipt, or whatever record the shop gives you for a single transaction). If even a single item from a receipt is not with you, the other items on that receipt cannot be checked either.
Separate purchases are handled separately
Items bought at another shop, or bought again in a separate transaction at the same shop, are looked at receipt by receipt. For example, if you still have everything from Shop A but used something from Shop B, the Shop A items can pass the customs check and are normally refunded. The Shop B items are not.
Do I need my receipt?
You do not always need to carry or show your receipts for the customs check. Customs may still ask to see them, so it is safest to keep them until you leave Japan.
Items that are not consumables
You may use them in Japan first. But in the end you need to take them out of Japan and have them pass the customs check.
Deadline
The customs check must be done when you leave Japan, within 90 days of the purchase date.
If you want your purchases and the 90-day deadline in one place, Kanpu, an app made by the people who run this site, does that.