lookup formula

sabi.kiss

Board Regular
Joined
Nov 7, 2009
Messages
118
Hi there,

Hopefully someone could help me with this.
I'm trying to do a leave planner for each one of our sites.
In the top row I've got the full financial year, day-by-day. On another sheet I've got column A with employee names, column B with leave start date and column C leave finish date. I am looking for a formula, which in planner sheet, in the second row, puts a X under the actual date, if that date is between start and finish date on the Data sheet.
That way, instead of highlighting days for each employee, I could do a automated sheet.
Would this be possible?

Thanks,
Sabi
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi Sabi,

Is this what you wanted?....


Excel Workbook
ABCDEFGHIJKL
1*14-Apr15-Apr16-Apr17-Apr18-Apr19-Apr20-Apr21-Apr22-Apr23-Apr24-Apr
2AkXXXXXXXX***
3Sabi*******XXXX
4MrExcel****XXX****
Planner




Excel Workbook
ABC
1NameStart DateEnd Date
2Ak14/04/201121/04/2011
3Sabi21/04/201125/04/2011
4MrExcel18/04/201120/04/2011
EmployeeDetails



The formula in B2 of Sheet Planner is this.....
=IF(AND(B$1>=EmployeeDetails!$B2,B$1<=EmployeeDetails!$C2),"X","")

Copy across and down as far as you need to go.

Good luck
 
Upvote 0
Thanks a lot Akashwani..that work good.
My other question is, what about if you get a duplicate name? Would it record all the data? So, if you got my name twice, with different leave taken, in different months, would it record both?
Will give it a try when I get to work today.

Cheers,
Sabi
 
Upvote 0
How could I integrate all this into a index/match formula, in case I've got duplicates, with different dates?

Thanks,
Sabi
 
Upvote 0
I worked out how to integrate it in a index/match formula. The only issue is that when it's a duplicate, it just take the first value from the top.
Here's what I put together so far:

IF(AND(Planner!B$5>=(INDEX(Data!$B7:$B2000, MATCH(Planner!$A9, Data!$A7:$A2000,0))), Planner!B$5<=(INDEX(Data!$C7:$C2000, MATCH(Planner!$A9, Data!$A7:$A2000,0)))),"AL","")

Planner!B5 is leave planner starting date
Data!B column is employee leave starting date
Data!C column is employee leave finish date
Planner!A9 & Data!A7 is employee name field

Could anybody help me how to actually use duplicates.

Thanks,
Sabi
 
Upvote 0
Try the below UDF:
Excel Workbook
ABCDEF
1*14-Apr15-Apr16-Apr17-Apr18-Apr
2AkXX   
3Sabi XXX 
4MrExcel  XXX
Planner


Code:
Function Date_Check(Nm As String, Dt As Date)

Dim Last_Row As Long
Dim i As Long
Dim s As String

Date_Check = ""

With Sheets("Data")
    Last_Row = .Range("A" & Rows.Count).End(xlUp).Row
    
    For i = 2 To Last_Row
        If .Cells(i, 1) = Nm Then
            If .Cells(i, 2) <= Dt And .Cells(i, 3) >= Dt Then
                Date_Check = "X"
            Exit Function
            End If
        End If
    Next i
End With


End Function
 
Upvote 0
that is absolutely fantastic. thanks a lot Neil.
is there a chance to add a command button, to actually refresh the Planner?
when i input new data, does not update the Planner sheet.

Sabi
 
Upvote 0

Forum statistics

Threads
1,224,519
Messages
6,179,263
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top