Function Problems

Count Vacation Hours from V-8 and V-4 Entries in Excel

Ayan MasoodAyan Masood Nov 18, 2026 869 views

Question details

Calculate total vacation hours from employee entries such as V-8 and V-4.

Count Vacation Hours from V-8 and V-4 Entries in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
An employee's vacation entries appear across a worksheet row, with each code representing a different number of hours.
Observed behavior
The desired total weights each V-8 entry as eight hours and each V-4 entry as four hours rather than counting each entry as one.
Before you start

Identify the cells containing the vacation codes and choose a total cell outside that range. Check that the entries use the codes V-8 and V-4 without extra spaces.

Solution 1Recommended

Use COUNTIF to total vacation hours by code

Use this formula when V-8 represents eight hours and V-4 represents four hours.

1
Select the total cell

In Excel, click an empty cell outside the vacation-entry range, such as CQ7 when the entries are in E7:CP7.

2
Enter the formula

Type =8*COUNTIF($E7:$CP7,"V-8")+4*COUNTIF($E7:$CP7,"V-4") and press Enter. Replace E7:CP7 with the range containing the employee's entries if needed.

3
Apply it to other employees

If other employees have entries in corresponding rows, drag the total cell's fill handle down to calculate each row.

Use COUNTIF to total vacation hours by code
Other vacation codes: The formula counts only V-8 and V-4. For another code, add a term such as +2*COUNTIF($E7:$CP7,"V-2").
Calculate vacation hours in WPS

Total Vacation Hours in WPS Spreadsheets

Use the same COUNTIF formula in WPS Spreadsheets to total hours from vacation codes in an employee's row.

  1. 1. Open the workbook: Open WPS Spreadsheets and use Open to select your employee vacation workbook.
  2. 2. Select a total cell: Click an empty cell outside the vacation-entry range, such as CQ7 for entries in E7:CP7.
  3. 3. Calculate the hours: Enter =8*COUNTIF($E7:$CP7,"V-8")+4*COUNTIF($E7:$CP7,"V-4") and press Enter. Adjust the range if your codes are in different cells.
  4. 4. Fill other rows: Drag the formula cell's fill handle down to calculate totals for other employees, then use Save to save the workbook.
Weight V-8 and V-4 entries by their corresponding hoursOpen and edit Microsoft Excel XLS and XLSX filesCopy the formula down for multiple employee rowsUse WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

Why does the formula multiply each COUNTIF result?

COUNTIF counts matching cells, not hours. Multiplying the V-8 count by 8 and the V-4 count by 4 converts those counts into hours before adding them.

How can I include a V-2 vacation code?

Add +2*COUNTIF($E7:$CP7,"V-2") to the formula, using the same range as the other COUNTIF terms.

Can I use the formula for several employees?

Yes. Enter it in the first employee's total cell and drag the fill handle down. The row numbers change for each employee while the dollar signs keep columns E and CP fixed.

Why is an entry not included in the total?

Check that the cell is within the COUNTIF range and contains V-8 or V-4 without extra spaces. Entries with other codes are not included unless you add them to the formula.