Assigning values to cells in one column based on the values of 2 other columns, please help!

helnuma2k

New Member
Joined
Feb 14, 2023
Messages
10
Office Version
  1. 365
Platform
  1. Windows
(Using Excel on Windows with a 365 subscription)
I have 4 columns.
Column A is store name (Jim's or Jane's).
Column B lists the date (each date from 1/1/2020 to 12/31/2020 repeated 24 times)
Column C lists the hour (so hours 1-24 for 1/1, hours 1-24 for 1/2, and so on for all dates of the year and for both stores)
Column D lists the price (for each hour of each date for each store).
There is also a list of Holiday dates in cells J2:J7.

CES Excel Exercise (version 2).xlsb
ABCDEFG
1StoreDateHourPricePeak LabelHolidays
2Jim's1/1/20131.69921/1/2020
3Jim's1/1/20230.51155/25/2020
4Jim's1/1/20337.63427/4/2020
5Jim's1/1/20430.25759/7/2020
6Jim's1/1/20532.221311/26/2020
7Jim's1/1/20630.432112/25/2020
8Jim's1/1/20737.4319
9Jim's1/1/20832.2977
10Jim's1/1/20932.5305
11Jim's1/1/201030.3367
12Jim's1/1/201131.7915
13Jim's1/1/201237.9923
14Jim's1/1/201339.8293
15Jim's1/1/201432.9674
16Jim's1/1/201536.6194
17Jim's1/1/201634.9222
18Jim's1/1/201731.6517
19Jim's1/1/201834.7415
20Jim's1/1/201938.1258
21Jim's1/1/202034.8405
22Jim's1/1/202139.6615
23Jim's1/1/202234.9142
24Jim's1/1/202336.3306
25Jim's1/1/202431.5972
26Jim's1/2/20138.4143
27Jim's1/2/20230.4804
28Jim's1/2/20336.1181
29Jim's1/2/20431.3793
30Jim's1/2/20536.5937
31Jim's1/2/20632.9125
32Jim's1/2/20730.1631
33Jim's1/2/20837.8865
34Jim's1/2/20938.8188
35Jim's1/2/201032.686
36Jim's1/2/201139.44
37Jim's1/2/201233.2197
38Jim's1/2/201333.3511
39Jim's1/2/201437.8378
40Jim's1/2/201535.1233
41Jim's1/2/201635.8917
42Jim's1/2/201739.3743
43Jim's1/2/201832.2757
44Jim's1/2/201939.1379
45Jim's1/2/202037.1487
46Jim's1/2/202138.0503
47Jim's1/2/202232.1134
48Jim's1/2/202335.6078
49Jim's1/2/202436.6932
50Jim's1/3/20134.681
51Jim's1/3/20232.3218
52Jim's1/3/20338.7249
53Jim's1/3/20439.5939
54Jim's1/3/20534.4275
55Jim's1/3/20630.4154
56Jim's1/3/20735.6202
57Jim's1/3/20839.1408
58Jim's1/3/20937.6058
59Jim's1/3/201032.5984
60Jim's1/3/201133.5998
61Jim's1/3/201234.1623
62Jim's1/3/201338.5912
63Jim's1/3/201434.1979
64Jim's1/3/201533.8471
65Jim's1/3/201635.6418
66Jim's1/3/201734.3031
67Jim's1/3/201830.8876
68Jim's1/3/201934.3648
69Jim's1/3/202035.324
70Jim's1/3/202134.8646
71Jim's1/3/202231.7107
72Jim's1/3/202337.5624
73Jim's1/3/202437.5842
74Jim's1/4/20133.4997
75Jim's1/4/20237.4538
76Jim's1/4/20336.9632
77Jim's1/4/20436.1518
78Jim's1/4/20538.0904
79Jim's1/4/20639.1718
80Jim's1/4/20735.1454
81Jim's1/4/20833.5299
82Jim's1/4/20938.3818
83Jim's1/4/201039.2794
84Jim's1/4/201136.0251
85Jim's1/4/201239.8796
86Jim's1/4/201332.5936
87Jim's1/4/201438.1273
88Jim's1/4/201539.234
89Jim's1/4/201632.4319
90Jim's1/4/201731.4229
91Jim's1/4/201839.2753
92Jim's1/4/201938.3822
93Jim's1/4/202034.8064
94Jim's1/4/202139.001
95Jim's1/4/202232.3328
96Jim's1/4/202336.9969
97Jim's1/4/202438.2818
98Jim's1/5/20131.8911
99Jim's1/5/20236.5902
100Jim's1/5/20339.7965
101Jim's1/5/20431.9386
102Jim's1/5/20531.9592
103Jim's1/5/20638.7669
104Jim's1/5/20730.7101
105Jim's1/5/20835.8923
106Jim's1/5/20937.0705
107Jim's1/5/201036.4278
108Jim's1/5/201138.7703
109Jim's1/5/201233.4863
110Jim's1/5/201336.9384
111Jim's1/5/201432.2052
112Jim's1/5/201537.0194
113Jim's1/5/201636.0485
114Jim's1/5/201734.918
115Jim's1/5/201832.7707
116Jim's1/5/201930.3686
117Jim's1/5/202034.288
118Jim's1/5/202138.0167
119Jim's1/5/202230.8594
120Jim's1/5/202331.7353
121Jim's1/5/202430.1511
122Jim's1/6/20139.6321
123Jim's1/6/20236.397
124Jim's1/6/20333.3301
125Jim's1/6/20436.3367
126Jim's1/6/20536.0135
127Jim's1/6/20634.0024
128Jim's1/6/20731.0391
129Jim's1/6/20831.3164
130Jim's1/6/20938.352
131Jim's1/6/201039.966
132Jim's1/6/201133.0835
133Jim's1/6/201239.6447
134Jim's1/6/201336.9602
135Jim's1/6/201436.7394
136Jim's1/6/201536.8171
137Jim's1/6/201636.5367
138Jim's1/6/201734.5397
139Jim's1/6/201832.9585
140Jim's1/6/201930.3666
141Jim's1/6/202035.6199
142Jim's1/6/202138.6363
143Jim's1/6/202235.9531
144Jim's1/6/202337.5356
145Jim's1/6/202434.6482
146Jim's1/7/20130.9441
147Jim's1/7/20236.6012
148Jim's1/7/20335.1579
149Jim's1/7/20437.0998
150Jim's1/7/20539.8102
151Jim's1/7/20635.4471
152Jim's1/7/20733.9698
153Jim's1/7/20837.4246
154Jim's1/7/20937.0545
155Jim's1/7/201031.6508
156Jim's1/7/201131.1299
157Jim's1/7/201236.3928
158Jim's1/7/201339.2357
159Jim's1/7/201437.3216
Store


I need a way to assign each cell in the range E2:E8785 (each hour of each day for Jim's store) a value of either 'Peak' or 'Non-Peak'.
If the date in column B is one of the dates in J2:J7, then the value in column E should be 'Non-Peak'.
However, if not a holiday, it should return 'Peak' if the respective date in column B is a weekday (Mon-Fri) AND if it falls between hours 8-23 (inclusive).And it should return 'Non-Peak' if the respective date in column B is a weekday (Mon-Fri) AND if it falls between hours 1-7 or hour 24.
It should also return 'Non-Peak' if the date falls on the weekend (Sat & Sun all hours).

I've tried various things, and I'm having trouble because I'm not sure if this problem can be solved with one formula that I can enter into E2 and then drag all the way down, or if I need to change how I'm thinking of the problem and break it down into multiple formulas. I'm really not sure the best way to approach it, so any help is much appreciated.

If you can't tell, I'm pretty much a beginner. Appreciate any help or insight you can provide!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
How about
Excel Formula:
=IF(AND(WEEKDAY(B2,2)<6,MEDIAN(C2,8,23)=C2,COUNTIFS(G:G,INT(B2))=0),"Peak","Non Peak")
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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