Formula Help

rehberger

Board Regular
Joined
Aug 28, 2013
Messages
52
Is it possible to write a formula that will return operating hours based on the data below? I would like the results to say reflect the open hours for example the deli results would say 8am-1pm

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]7am[/TD]
[TD]8am[/TD]
[TD]9am[/TD]
[TD]10am[/TD]
[TD]11am[/TD]
[TD]12pm[/TD]
[TD]1pm[/TD]
[TD]2pm[/TD]
[TD]3pm[/TD]
[TD]4pm[/TD]
[/TR]
[TR]
[TD]Deli[/TD]
[TD]closed[/TD]
[TD]open[/TD]
[TD]open[/TD]
[TD]open[/TD]
[TD]open[/TD]
[TD]open[/TD]
[TD]open[/TD]
[TD]closed[/TD]
[TD]closed[/TD]
[TD]closed[/TD]
[/TR]
[TR]
[TD]Buffet[/TD]
[TD]open[/TD]
[TD]open[/TD]
[TD]open[/TD]
[TD]open[/TD]
[TD]open[/TD]
[TD]open[/TD]
[TD]closed[/TD]
[TD]closed[/TD]
[TD]closed[/TD]
[TD]closed[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Results[/TD]
[/TR]
[TR]
[TD]Deli[/TD]
[TD]8am-1pm[/TD]
[/TR]
[TR]
[TD]Buffet[/TD]
[TD]7am-12pm[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
How about this?


Excel 2016 (Windows) 32 bit
DEFGHIJKLMN
157am8am9am10am11am12pm1pm2pm3pm4pm
16Deliclosedopenopenopenopenopenopenclosedclosedclosed
17Buffetopenopenopenopenopenopenclosedclosedclosedclosed
18
19Deli8am-1pm
20Buffet7am-12pm
Sheet2
Cell Formulas
RangeFormula
E19=INDEX(E$15:N$15,,MATCH("open",E16:N16,0))&"-"&INDEX(E$15:N$15,,MATCH("open",E16:N16))
 
Upvote 0
Based on Ali's formula, try this

I think you will have to use the Text function or else it will give you decimal numbers.

=TEXT(INDEX(E$15:N$15,,MATCH("open",E16:N16,0)),"hh AM/PM")&"-"&TEXT(INDEX(E$15:N$15,,MATCH("open",E16:N16)),"hh AM/PM")
 
Upvote 0
Ali, I tried but it didn't work unless i give it a format using text function. So I thought of suggesting OP of the same.
 
Upvote 0
Well, it depends how you think it is set up. It looks as if you are assuming the the opening times across the top are times with a custom format, but I am assuming that they are just text (e.g. "7pm", etc.). We'll have to wait and see.
 
Last edited:
Upvote 0
Ohh yes. This is exactly why I had to use the text function. I must say "Good catch".
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

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