SOLVED

Check the value of a function

%3CLINGO-SUB%20id%3D%22lingo-sub-1639830%22%20slang%3D%22en-US%22%3ECheck%20the%20value%20of%20a%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1639830%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20table%20that%20contains%20all%20current%20month%20days%2C%20the%20days%20are%20displayed%20on%20each%20column.%3C%2FP%3E%3CP%3EFor%20example%2C%20in%20my%20B1%20cell%2C%20I%20added%20the%20following%20function%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DDATE(Tableau2%5BCurrent%20year%5D%2CTableau2%5BStarting%20month%5D%2C1)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3ETableau2%5BCurrent%20year%5D%20%3D%202020%20and%20Tableau2%5BStarting%20month%5D%20%3D%201%20(January)%3C%2FP%3E%3CP%3EThe%20cell%20C1%20will%20contains%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DB1%2B1%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EWhat%20I%20need%20is%2C%20if%20the%20current%20day%20is%20saturday%20or%20sunday%2C%20then%20the%20cell%20will%20be%20disable%20or%20just%20the%20background%20will%20change.%20But%20my%20problem%20is%20that%20I%20can't%20check%20that%20with%20the%20function%20IF%2C%20I%20can't%20verify%20the%20value%20of%20B1%20or%20C1.%3C%2FP%3E%3CP%3EMy%20question%20is%2C%20how%20can%20I%20create%20a%20condition%20to%20check%20the%20value%20or%20the%20result%20of%20a%20function%20in%20a%20specific%20cell%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1639830%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1640105%22%20slang%3D%22en-US%22%3ERe%3A%20Check%20the%20value%20of%20a%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1640105%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F782832%22%20target%3D%22_blank%22%3E%40spamitovic%3C%2FA%3E%26nbsp%3BYou%20may%20use%20Conditional%20Formatting%20to%20achieve%20what%20you%20describe.%20It%20formats%20cells%20based%20on%20its%20displayed%20content%2C%20not%20the%20underlying%20formula.%20A%20working%20example%20is%20attached.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1642710%22%20slang%3D%22en-US%22%3ERe%3A%20Check%20the%20value%20of%20a%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1642710%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F782832%22%20target%3D%22_blank%22%3E%40spamitovic%3C%2FA%3E%26nbsp%3B%20The%20translation%20isn't%20very%20good%20but%20I%20think%20what%20you%20want%20is%20to%20add%20'%24'%20in%20formula%20as%20so%3A%3C%2FP%3E%3CP%3E%3DOR(WEEKDAY(C%243%2C2)%3D6%2CWEEKDAY(C%243%2C2)%3D7)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi all,

 

I have a table that contains all current month days, the days are displayed on each column.

For example, in my B1 cell, I added the following function:

=DATE(Tableau2[Current year],Tableau2[Starting month],1)

Tableau2[Current year] = 2020 and Tableau2[Starting month] = 1 (January)

The cell C1 will contains 

=B1+1

What I need is, if the current day is saturday or sunday, then the cell will be disable or just the background will change. But my problem is that I can't check that with the function IF, I can't verify the value of B1 or C1.

My question is, how can I create a condition to check the value or the result of a function in a specific cell?

 

5 Replies
Highlighted

@spamitovic You may use Conditional Formatting to achieve what you describe. It formats cells based on its displayed content, not the underlying formula. A working example is attached.

Highlighted

@Riny_van_Eekelen Yes but I can apply these conditions only the two first line.

You can check in the attachment, when I try to select all tables, the condition is applied to other cells that are not required.

I need to change the background only for the weekends.

Highlighted
Best Response confirmed by spamitovic (Occasional Contributor)
Solution

@spamitovic  The translation isn't very good but I think what you want is to add '$' in formula as so:

=OR(WEEKDAY(C$3,2)=6,WEEKDAY(C$3,2)=7)

 

Highlighted

@spamitovic Add the dollar signs as @mtarler suggested and it will work.

Screenshot 2020-09-08 at 07.33.06.png

Highlighted

@Riny_van_Eekelen @mtarler 

Thank you so much for your help. Problem solved now.