Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8874095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:38:06+00:00 2026-06-14T18:38:06+00:00

All I have an excel sheet containing below mentioned type of data. 01-Aug-2012 EST213

  • 0

All I have an excel sheet containing below mentioned type of data.

  01-Aug-2012   EST213  Sowmya  Shivashankar    11  0   11  4   0   LOP
  01-Aug-2012   EST101  Prashanth  P    12  8   20  5   5.28    0     Half-day
  08-Aug-2012   EST213  Sowmya  Shivashankar    11  0   11  4   0   LOP

Here I am giving one one day data for one employee. Like this I have around 3 thousand of rows of data for one month. I need to calculate need to count for a particular employee how many LOP or Half-day in month.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:38:07+00:00Added an answer on June 14, 2026 at 6:38 pm

    You can try use mapping between employees and their monthly entries.
    NOTE: this is almost complete code, but some parts like parsing row or month number you need to do by yourself

    class EmployeeEntry {
        String date;
        String name;
        String surname;
        // other fields representing excel columns
    
        TYPE_OF_DAY typeOfday;
    
        public static enum TYPE_OF_DAY {
            LOP, HALF_DAY, OTHER
        }
    
        public String getEmployeeID() {
            // you may return name+surname or some unique ID
            return name + " " + surname;
        }
    
        public Integer getMonth() {
            String monthStr = date.split("-")[1];
            return asMonthNumber(monthStr);
            // implement asMonthNumber to convert Aug --> 08
        }
    }
    
    public class A {
    
        private Map<String, Map<Integer, List<EmployeeEntry>>> entries;
    
        public void parseExcel(HSSFSheet sheet) {
            entries = new HashMap<String, Map<Integer, List<EmployeeEntry>>>();
            Iterator<Row> iter = sheet.iterator();
            // for every row
            while (iter.hasNext()) {
                Row row = iter.next();
                // parse will call getString, getNumber etc of the current row
                EmployeeEntry entry = parse(row);
                Map<Integer, List<EmployeeEntry>> userMonthlyEntriesMap = getOrCreate(entry
                        .getEmployeeID());
                List<EmployeeEntry> monthlyEntries = getOrCreate(
                        userMonthlyEntriesMap, entry.getMonth());
                monthlyEntries.add(entry);
            }
        }
    
        public int countLOP(String employeeID, Integer monthNum) {
            int counter=0;
    
            Map<Integer, List<EmployeeEntry>> map = entries.get(employeeID);
            if (map != null) {
                List<EmployeeEntry> list = map.get(monthNum);
                if (list != null) {
                    for (EmployeeEntry entry : list) {
                        if (entry.typeOfday == EmployeeEntry.TYPE_OF_DAY.LOP) {
                            counter++;
                        }
                    }
                }
            }
            return counter;
        }
    
        private List<EmployeeEntry> getOrCreate(
                Map<Integer, List<EmployeeEntry>> userMonthlyEntriesMap,
                Integer month) {
            List<EmployeeEntry> monthlyEntries = userMonthlyEntriesMap.get(month);
            if (monthlyEntries == null) {
                monthlyEntries = new LinkedList<EmployeeEntry>();
                userMonthlyEntriesMap.put(month, monthlyEntries);
            }
            return monthlyEntries;
        }
    
        public Map<Integer, List<EmployeeEntry>> getOrCreate(String emplID) {
            Map<Integer, List<EmployeeEntry>> entryList = entries.get(emplID);
            if (entryList == null) {
                entryList = new HashMap<Integer, List<EmployeeEntry>>();
                entries.put(emplID, entryList);
            }
            return entryList;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I've got this Excel sheet of employees which have all the information about
I have a excel sheet with 7 fields. I want to remove/filter all the
I have an excel sheet that has dde links to real time market data.
HI all , I have used a POI API and make excel sheet. I
I have no problem in writing data in excel sheet which is stored in
I have data imported from an excel sheet into a table in db. Now
In an Excel sheet, I have roughly 30 rows x 100 columns of data.
I have coded a php script to import excel sheet data to mysql database..code
I have an excel sheet similar to : I want to read data columns
I have an excel sheet that I am wanting to extract data from and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.