Place Expenses in Category Columns with Excel Formulas
Question details
Display each expense amount in the column matching its category number.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Expense amounts are in column C, category numbers 1 through 5 are in column D, and category output columns are E through I.
- Observed behavior
- Each expense should appear in its matching category column on the same row, while the other category cells appear blank.
Check that the first expense is in row 2 and that column D contains numeric category values from 1 through 5. Make sure columns E through I are available for the results.
Use IF formulas for each expense category
Use these formulas to display each amount in the category column that matches its number.
Select E2 and enter =IF(D2=1,C2,"").
Enter =IF(D2=2,C2,"") in F2, =IF(D2=3,C2,"") in G2, =IF(D2=4,C2,"") in H2, and =IF(D2=5,C2,"") in I2.
Select E2:I2 and drag the fill handle down to the last expense row. Each formula will use the amount and category from its own row.

Organize expense categories in WPS Spreadsheet
Use an IF formula in WPS Spreadsheet to display each expense in the category column that matches its number, then fill the formula across and down.
- 1. Open the workbook: Open WPS Spreadsheet and use Open to select the workbook containing the expenses.
- 2. Enter the formula: Select E2 and enter =IF($D2=COLUMN()-4,$C2,"").
- 3. Fill the category columns: Drag the fill handle from E2 across to I2. The formula compares the category number with each destination column.
- 4. Fill down and save: Select E2:I2, drag the fill handle down to the last expense row, and use Save to keep the changes.

Frequently Asked Questions
What happens if a category is outside the range 1 to 5?
None of the formulas in E through I will match, so those cells will appear blank. Check the category value in column D and correct it if needed.
Do the formulas move the expense out of column C?
No. The IF formulas display the amount in a category column while leaving the original value in column C.
Why does a category cell appear blank?
The formula returns an empty string when the number in column D does not match that column's category. Check that the category is a number from 1 to 5 and that the formula refers to the correct row.
Can I use these formulas in WPS Spreadsheet?
Yes. Open the workbook in WPS Spreadsheet, enter the IF formulas in E2:I2, and drag the fill handle down to apply them to the remaining rows.




