Reference a cell in a named range

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Maybe
Code:
Sub chk()
MsgBox Range("myrng").Cells(3, 1).Value
End Sub
 
Upvote 0
I have multiple events sequenced throughout the day, each with a start time and and an end time. I need to calculate the delay between when one event ended and the next event started.

In the table below, I have named ranges called "StartTime", "EndTime" and "Delay". I need to create a formula that subtracts the end time of event#1 from the start time of Event#2. It's easy if I use Row/column references. But when I use Named ranges, I need to be able to identify a particular cell with a named range.

For example, if I could use a cell name such as "StartTime1" to identify the column as "StartTime" and the row as "1", that would address my problem.

Hope this makes sense.
Thanks for your help.
Jim


Event Start Time End Time Delay

Event#1 10:00 11:00 N/A
Event#2 11:05 11:30 0:05
Event#3 11:45 12:00 0:15
 
Upvote 0
Sorry, the table didn't display well at all. I'll try pasting a table

Jim


[TABLE="width: 367"]
<colgroup><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Event[/TD]
[TD] [/TD]
[TD]StarTime[/TD]
[TD] [/TD]
[TD]EndTime[/TD]
[TD] [/TD]
[TD]Delay[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD] [/TD]
[TD]10:00[/TD]
[TD] [/TD]
[TD]11:00[/TD]
[TD] [/TD]
[TD]N/A[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD] [/TD]
[TD]11:05[/TD]
[TD] [/TD]
[TD]11:15[/TD]
[TD] [/TD]
[TD]0:05[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD] [/TD]
[TD]11:30[/TD]
[TD] [/TD]
[TD]12:10[/TD]
[TD] [/TD]
[TD]0:15[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
I think I would just use the cell references as the formula is much simpler, but would this suffice if you really want to use the named ranges?
D2 would house a manual "N/A"
D3 copied down.

Excel Workbook
ABCD
1EventStarTimeEndTimeDelay
2110:0011:00N/A
3211:0511:150:05
4311:3012:100:15
Delay
 
Last edited:
Upvote 0
I think I would just use the cell references as the formula is much simpler, but would this suffice if you really want to use the named ranges?
D2 would house a manual "N/A"
D3 copied down.

Delay

ABCD

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:51px;"><col style="width:71px;"><col style="width:70px;"><col style="width:52px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]
[TD="align: right"]Event[/TD]
[TD="align: right"]StarTime[/TD]
[TD="align: right"]EndTime[/TD]
[TD="align: right"]Delay[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]10:00[/TD]
[TD="align: right"]11:00[/TD]
[TD="align: right"]N/A[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]11:05[/TD]
[TD="align: right"]11:15[/TD]
[TD="align: right"]0:05[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]11:30[/TD]
[TD="align: right"]12:10[/TD]
[TD="align: right"]0:15[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
D3=INDEX(StartTime,ROWS(D$1:D3)-1)-INDEX(EndTime,ROWS(D$1:D3)-2)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Hi,

I agree, it's not worth using named ranges if that's what's required to reference a specific cell within a range.

Thank you for you help.
Jim
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

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