• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

formula required for day wise when leave is more than 1 day

m9vukyem

Member
Dear sir,

Please provide the formula for my leaves register is from to to date now i want to date wise segregation required
 

Attachments

  • Leave Data required.xlsx
    12.8 KB · Views: 10
Here is a Power Query solution.
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Serial No", Int64.Type}, {"Emp Code", Int64.Type}, {"Emp Name", type text}, {"Leave from", type date}, {"Leave to", type date}, {"No of Leaves", Int64.Type}, {"Type of Leave", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "List", each List.Dates([Leave from],[No of Leaves],#duration(1,0,0,0))),
    #"Expanded List" = Table.ExpandListColumn(#"Added Custom", "List"),
    #"Removed Other Columns" = Table.SelectColumns(#"Expanded List",{"Emp Code", "Emp Name", "Type of Leave", "List"}),
    #"Added Index" = Table.AddIndexColumn(#"Removed Other Columns", "SN", 1, 1, Int64.Type),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Index",{{"List", type date}}),
    #"Reordered Columns" = Table.ReorderColumns(#"Changed Type1",{"SN", "Emp Code", "Emp Name", "List", "Type of Leave"})
in
    #"Reordered Columns"
 

Attachments

  • Leave Data required.xlsx
    19.5 KB · Views: 5
Where do You need F-column values?
... from D-column to E-column values.
Here other kind of sample solution ...
 

Attachments

  • Leave Data required.xlsb
    17.9 KB · Views: 8
FYI: How to employ Power Query Mcode supplied by GraH - Guido

Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Thank you for giving information about power query but I Need a formula sir. i have no knowledge about powe query
 
In the attached, a udf called blah.
This formula needs to be array-entered (commit the formula to multiple cells at once using Ctrl+Shift+Enter rather than the usual plain Enter).
The area you need to select needs to be 5 cells wide, but the number of rows will vary according to your data; if you choose too few rows the result will show how many rows you need to use. See cells O12 to Q14 in the attached.

1748897918297.png

The correct number of rows was selected when the formula was array-entered into J12:N19 of the attached.
I leave you to add the headers to the result and to format column 4 as a date.

1748897817192.png

Asking for a formula using built-in functions to do this is akin to asking a courier to deliver a package from London to Edinburgh insisting he uses a penny-farthing bicycle rather than a train or a car (and not compensating him for it either).

1748898126206.jpeg
 

Attachments

  • Chandoo58567Leave Data required.xlsm
    18.9 KB · Views: 2
Back
Top