Why is this excel formula not evaluating properly - excel

I have created a spreadsheet with a section for each day that is broken into half hour segments (as pictured). I am trying to build a formula that can be dragged down and return the date at the top of each daily section (I am ultimately planning to use this formula as part of a conditional formatting rule)
The formula that I have entered in C4 should return the date shown in C2 but it is actually returning the value of C3. If I highlight the part of the offset formula that refers to the row 0-(B4-"0700")*48 and force it to evaluate using F9, it evaluates as -2. If I then explicitly enter -2 into the row parameter of the formula it returns the correct value in C2
Is there any reason the formula is returning the wrong value?

Related

EXCEL: Auto number rows until value in cell

This is probably very easy, but I can't seem to get it to work.
I'd like a formula for autonumbering rows based on the value in B1.
Starting from B1 id like to autonumber rows from 1 and down until the value defined in B1.
This need to be a formula, and not VBA beacuse of other technical obstacles cannot solve.
I manage until I reach the defined value (blank) is returned, and the next row returns #VALUE because the calculation fails.
I have tried all the IF, IFS, <>"", <=, >=, AND, OR combinations I can think of.
How can I define this and avoid the #VALUE error.
The defined value in B1 will be a value ranging from 6 to 48
Would really appreciate help on this.
If you have Excel 365 you can use SEQUENCE:
Put =SEQUENCE(B1,1,1,1) in the cell below Month
The values will spill down - that means there have to be enough empty cells below the formula cell
This will create a numbered sequence --> number of rows is set via value in B1, one column, starting at 1

How to refer to a current cell in a range when using conditional rules?

I have a column of cells range(A2:A10) containing a date for the first day of each week.
I want the cell color to change when the date is in the past.
When I select the cells I can apply a conditional rule but I can't figure out how to write the formula so it applies to each individual cell.
For example:
formula
=A2>TODAY()
works
However that rule will apply to the whole range returning the result for whether the date value in A2 is in the past.
I want the formula so that the value in A3 is the deciding factor for cell A3, A4 is the deciding factor for A4 etc..
The best way I can explain it would be using "this" in coding when writing the formula.
Select cells you want formatting in. For example A2:A10. When creating rule choose "Format only cells that contains" and in "Format only cells with:" choose "less than" and write =TODAY() formula:
Result:
Keep in mind that date format may be different due to settings.
Also tested your formula and it works fine:

Excel If Formula Error

I am working on excel sheet with multiple formulas. One thing that made me wonder is the IF formula. Consider the below table filled from Cell E3 to G5.
The formula that I am using at cell G5 is
=IF((G3+G4)=(E5+F5),+G3+G4,"OFF")
Considering the values from example itself, the formula should evaluate TRUE and total the G3 and G4, but I am not sure why it not evaluating TRUE. I checked for number format for all the cells, it is having the format as accounting.
You can round the numbers before adding them:
=IF((ROUND(G3,2)+ROUND(G4,2))=(ROUND(E5,2)+ROUND(F5,2)),G3+G4,"OFF")
If you are calculating any of the values by formula then you may have a very small decimal that the formatting is dropping off. For example if G4 = -59400003.570001 then your value will be "OFF".
I recommend hard-coding the values and verifying that the values are truly to the penny and not smaller.

Conditional formatting: automatically refer to the next cell?

I have a schedule with team member names and the column headers are half hour time intervals. I want to shade the cells of hours each person does not work with gray according to their shift schedule, so that I know not to schedule that person during that hour.
I have created a separate table with each person's shift schedule, and the names appear in the same order as in the schedule.
Is there any way to conditionally format the cells at once? There has to be an easier way then what I am doing now...which is one by one clicking on each person's cell and creating the formatting formula.
I can't copy paste the formatting because the formula still refers to the previous person's shift on the other table. I need it to refer to the next row.
The formula I use for conditional formatting is:
='Job Functions'!$O$5>$C$9
Where Job Functions is the sheet that contains the shifts, O5 is the shift assigned to that employee, and C9 is the column header on the schedule (6:30am). I just clicked on the cell and created a new conditional formatting rule from the excel ribbon on top...no vba.
If there is a VBAsolution to this that'd be great! I'm fairly new to VBA
Conditional formatting works like this
Let's say I have an array of numbers in A2:E5 and a header row in A1:E1. I want to have my array of number be green if the value of the cell is greater than it's column header. That is to say I want to compare A2>A1, B5>B1, D4>D1, etc. this means I want the header row comparison to be constant.
In Excel formulas you use the $ symbol to maintain constant references. Since I want the row to stay constant but I want the column to be relative to the cell in my array of numbers my header reference will be A$1 (column is relative, row is locked).
This is just the formula used to determine if formatting will be applied or not. If it returns true then the conditional formatting is applied, if it returns false then nothing happens.
However, where the formatting is applied is determined by the Applies to reference. In my example below I am applying the formula A$1<A2 to $A$2:$E$5. This means that in the cell A2 the formula A$1<A2 is used to determine if formatting is applied, but in B3 the formula B$1<B3 is applied. This is the same logic as if you were to have dragged the formula itself into these cells.
If instead my Applies to formula were $B$2:$E$5 this means that B2 would be colored green if A$1<A2, and B3 would be colored green if A$1<A3.
So with all that your formula should probably be
='Job Functions'!O5>C$9
drag and drop it down to fill the other cells

prevent value from changing once formula is applied

I have the following formula in my activity sheet in the date column
=IF(ISBLANK(A1),"",TODAY())
This is to automatically populate the cell with the current date if A1 is not empty, i have applied this formula to all the cells in column A. But everyday i open the sheet to add my activities the previous days date value automatically changes to the current date, Is there any way to lock the cells value from changing once the formula is applied for the first time or is there an alternate way
Copy the field and inset as value in to the same . This way, the formula gets replaced with the value and never changes.
Otherwise let the formula reference to a static field which has the date in it.
Assuming the formula is in B1:
With iterative calculation (options > formulas > check "enable iterative calculation") you can use this formula:
=IF(A1="","",IF(B1="",TODAY(),B1))
if anything is in A1 then B2 will show the actual date but if B1 alredy has a value, it shows the old one (open it up days later will still show the old date) but empty out A1 to reset and a new entry will show the actual date again (just switching the value wont work, you need to empty A1 to get the actual date)

Resources