Nested If Function

shamrock1118

New Member
Joined
May 4, 2017
Messages
3
SO I have employee schedules sent to me like this:

Employee Name: name SundayMondayTuesdayWednesdayThursdayFridaySaturday
Start/End Time: 8:30 AM Week 1 XXXXX

<tbody>
</tbody>

And I'm getting them in by the hundreds and I would like to write a formula that reads it for me and tells me,
based on certain criteria, which arbitrary schedule number it is. (Schedule numbers were assigned randomly. They are just being used as a reference.) Each schedule number has a unique start time.

So this is the formula I have going on here for the above schedule:

=IF($C6=BV$4,IF($F6="",IF($G6="X",IF($H6="X",IF($I6="X",IF($J6="X",IF($K6="x",IF($L6="",BV$5,""),""),""),""),""),""),""),"")

BPBQBRBSBTBUBVBWBX
7:00 AM7:15 AM7:30 AM7:45 AM8:00 AM8:15 AM8:30 AM8:45 AM9:00 AM
555657585960616263

<tbody>
</tbody><colgroup><col><col span="7"><col></colgroup>


C6 is the column with start time that was sent to me, BV$4 is the column containing the start time that matches the criteria of the schedule number in BV$5.

Now, for SOME UNGODLY REASON my formula works for MOST of the schedules EXCEPT for a select number of schedules. Schedule number 61 for example will not work. I don't understand.

PLEASE HELP.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I dont understand what youre trying to achieve.

Why have you got all those IFs when the only result would be BV5 or blank?
You could simply MATCH the time against the BP:BX column range.
Further instead of all those IFs you could just change it to

IF(AND(COUNTA(F6:L6)=6,F6=""),BV5,"")
 
Upvote 0
Special-K99 - I'm equally confused by the requirement, but I don't think it's to check for 6 blanks in the range F6:L6.

I think it includes a check that F6 and L6 are both blank, and G6:K6 are all = "X".
 
Upvote 0
I don't think that's quite reflective of the formula. Perhaps:

=IF(AND(COUNTA($F6:$L6)=5,$F6="",$L6="",$C6=BV$4),BV$5,"")

WBD
 
Upvote 0
I figured it out actually. The problem with the proposed solutions is that each schedule is unique to a certain days-off to days-on combination. For example, the employee could have Sunday, Monday, and Thursday off and it would calculate as three days off, however; if they have Sunday, Tuesday, and Saturday off, it would still calculate as three days off however the schedules are different and therefore should return a different schedule number.

For future reference, I got the function to work. I think there were just corrupt cells or something because I opened a new workbook and redid the formulas and TA-DA! It worked... strange. Thanks for the help though!
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,392
Members
449,445
Latest member
JJFabEngineering

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