Reference function

monkey_wrench

New Member
Below are two spreadsheets. Spreadsheet 1 contains a date field and Manufacture A, B and C as headers. Under each manufacture are the hours worked and the corresponding dates of the hours that were worked.

Spreadsheet 2 is a table that I would like to reference spreadsheet 1 using “lookup functions”. Referencing the Manufacture and total hours is an easy reference to make. The problem is automating the lookup for the Start date and Finish date. What I would like it to do for the START DATE is to look for the first hours worked and return the corresponding date, I.E. Manufacture A would be 1/12/04, Manufacture B would be 1/13/04, etc. I would also like to do the same thing for the DATE FINISHED I.E Finish date for Manufacture A would be 1/17/04, man B would be 1/16/04 and Man C would be 1/15/04. how can I do this???????

-----------------------------------------------
------------------------------------------------

_Date _| A | B | C |

1/12/04 | 4 | 0 | 0 |
1/13/04 | 4 | 2 | 0 |
1/14/04 | 2 | 6 | 1 |
1/15/04 | 0 | 6 | 5 |
1/16/04 | 0 | 5 | 0 |
1/17/14 | 4 | 0 | 0 |

-------------------------------------------
--------------------------------------------

Manuf | start date| finish date| Total hours|

____ ____________________________________
Manu A | 1/12/04 | 1/17/14 | 14
_________________________________________
Manu B | 1/13/04 | 1/16/04 | 19
_________________________________________
Manu C | 1/14/04 | 1/15/04 | 6

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Egress1

Active Member
Howdy,

I couldn't figure out how to do this with LOOKUP function since the hour numbers are variable and LOOKUP requires a sorted list but here it is using nested IF statements. HTH
lookup.xls
ABCDEFGHI
1DateABCMANUSTARTFINISHHOURS
201/12/04400A01/12/0401/17/0414.00
301/13/04420B01/13/0401/16/0419.00
401/14/04261C01/14/0401/15/046.00
501/15/04065
601/16/04050
701/17/04400
801/18/04000
Sheet1

MrExcel MVP
Let A1:D8 on Sheet1 house the sample you provided, including labels.

Sheet2
Book1
ABCDE
1MANUSTARTFINISHHOURS
21A1/12/20041/17/200414
32B1/13/20041/16/200419
43C1/14/20041/15/20046
Sheet2

Formulas...

A2:

=MATCH(\$B2,Sheet1!\$B\$1:\$D\$1,0)

C2:

=INDEX(Sheet1!\$A\$2:\$A\$8,MIN(IF(INDEX(Sheet1!\$B\$2:\$D\$8,0,\$A2)>0,ROW(INDEX(Sheet1!\$B\$2:\$D\$8,0,\$A2))))-(CELL("Row",Sheet1!B\$2)-1))

which must be confirmed with control+shift+enter instead of just with enter.

D2:

=INDEX(Sheet1!\$A\$2:\$A\$8,MAX(IF(INDEX(Sheet1!\$B\$2:\$D\$8,0,\$A2)>0,ROW(INDEX(Sheet1!\$B\$2:\$D\$8,0,\$A2))))-(CELL("Row",Sheet1!C\$2)-1))

Again confirm with control+shift+enter.

E2:

=SUM(INDEX(Sheet1!\$B\$2:\$D\$8,0,\$A2))

monkey_wrench

New Member
Just wanted to thank you guys for the help...I will try both the formulas and see which one works better for me...thanks again
-Gerrit

Replies
3
Views
257
Replies
1
Views
129
Replies
2
Views
119
Replies
5
Views
467
Replies
4
Views
241

1,187,178
Messages
5,962,051
Members
438,578
Latest member
MrJimC

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?

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

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