I have 2 columns. I want to change the color of column B based on selected text in column A.
for example:-
If I select a specific text in column A that is "ABC" or "CBD" or "EFG".
value in column B should not be less than 0, if the value is less than 0 than format the cell with color red and if it more than 0 than color it with green.
I have been trying it with conditional format, but eventually its not working it out.
Your question is confusing. First you say you want to change the color of 'Column B' based on the text value, then you say you want to change the color based on whether the number is greater than or less than 0 but you didn't say what column these numbers were in.
I made a sample that will change the color of 'Column B' to either red or green based on the value of that number. But if you want to change the color of a cell based on the text value then you will have to create a rule for each of the text values you are dealing with then assign it to whatever cells you wish to affect.
If you could clarify the question for us a little, we could probably help you out with a more accurate solution.
Related
I have an attendance excel sheet that includes staff names and time in and out.
consider L grey color = 1 and Pink color cell consider as 0.50.
here I want to calculate for the column
"emp4" have 2.50 (leaves taken), [Having two L mentioned in grey cell and one pink cell includes 1:30PM]
emp6 have 0.50(leave taken), [Having 2:30PM in pink color]
emp8 have 1(leave taken). [Having 12.36PM and 3:30PM - two pink color cells. so 0.50 + 0.50 =1 ]
So I need to calculate leaves by month-wise based on the cell color. Can anyone please help me to do this?
The colour of a cell does not contain any information about the cell value, so it can't be used as an input for whatever formula.
However, you can turn things around: you can create conditional formatting, colouring the cell based on its value. As such, the colour of the value will be a measure for the cell's value and you can make it look like colour being based on colours (although in background they are always based on values).
In excel, I have the following:
I am trying to find the quickest and most user-friendly way to compare columns 2 and 1.
If a name in column 2 (in the format shown below) matches ANY of the cells in Column 1, the cell in Column 1 goes GREEN, indicating that user is PRESENT in Column 2.
I have played around with conditional formatting but would appreciate any direct and efficient solutions.
I was trying to adapt a version of this, but it failed to work:
=SUMPRODUCT(--(MID($A4&" "&$A4,FIND(",",$A4)+2,FIND(",",$A4&" "&$A4,FIND(",",$A4)+2)-FIND(",",$A4)-2)=$B$4:$B$33))
where the above formula was added on highlighting the first column and then ensuring the A4 referred to the first item in Column 1 and the B was the first and last item in column 2. As mentioned, this didn't work.
Update
Tried this as well but didn't work.
This answer written assuming column1 = column A, and column2 = column B
Apply a conditional format on column 1, set up with green background, with the formula =COUNTIF(B:B, A1)>0
Apply another conditional format on Column 1, set up with red background, formula =COUNTIF(B:B, A1)=0
Edit those formulas as necessary so that:
B:B is the address of column 2, the range you're looking in for each name
A1 is the address of the first (top-left) cell that the conditional format applies to.
You can select both columns and do Conditional Formatting, Highlight Cells, Duplicate Values. That would be the easiest way to compare. You can format the cells in the first list with red fill if you want them to be red and set the format for duplicate values with green fill. This will format it in the color scheme you showed. If the name is removed from the second column, the cell will go back to red.
I have a 13x13 table of data on a worksheet that is comprised of links to another sheet.
For example the first row of 13 looks like:
=Sheet1!R7 =Sheet1!R20 =Sheet1!R21 =Sheet1!R22 =Sheet1!R23 =Sheet1!R24 =Sheet1!R25 =Sheet1!R26 =Sheet1!R27 =Sheet1!R28 =Sheet1!R29 =Sheet1!R30 =Sheet1!R31
I want to do conditional formatting over the entire table for when data from column R and column C of the same row are equal and >0.
For example;
When Sheet1!R7 is equal to Sheet1!C7 and >0, color the sheet 2 table (that has the link) red.
When Sheet1!R20 is equal to Sheet1!C20 and >0, color the sheet 2 table red and so on.
I would also like to repeat the process with a different colored fill if R == L and >0 but I can just use the same formula once I know how.
My attempt was =AND(Sheet1!R7=Sheet1!C7,Sheet1!C7>0).
This works for the single cell, but I'd like a way to do the whole table at once.
Any help is appreciated, thanks.
EDIT for clairty:
*I'm sure I'm not explaining it too well.
To put it simply, I have 2 columns of numbers, let's say A1:A169 and B1:B169.
I want to take the larger number from A and B for each row (A10 vs B10 etc, I used MAX function for this) and dump the output in column C.
I then aim to color code column C based on whether the number comes from column A or B. Red for A, yellow for B (no color for <0).
So far I have achieved all of this, I have the data sitting in a column color coded.
My problem comes in that I want to have the 169 numbers in column C in a more readable format, I.E. in a 13x13 grid table. I don't know how to do this and keep the color coding!*
I suppose I can offer you some possible solution.
Lets say you have sheet1 and sheet2. In sheet2, you have links to
sheet1 as you mentioned. And my understanding is that you want to color
the sheet2 (the entire table?) as red if a certain condition is met.
This is how it might be done.
In sheet 2, create a formula for a cell which reflects your condition. Lets say that is =IF(Sheet1!A1="foo", 1, 0). You can add your AND conditions in that if statement. So that cell will contain 1 if the condition is met and 0 if not met.
Select the range of cells in sheet2. Click conditional formatting. Select "use a formula to determine which cells to format". Enter the condition for the calculated value in sheet2. For example, in sheet2, my cell G1 is the result of the formula =IF(Sheet1!A1="foo", 1, 0). So if the value of G1 is 1 then I want to color the range Red.
So in essense, we are using a formula to calculate the value of a cell and using that value
as a condition to format a range of cells in Sheet2.
Hope this helps.
Let's say I have a row like this:
Grade Q1 Q2 Q3
? Green Red Green
The function for "Grade" (A2) needs to be as follows:
If 2 of 3 B2, B3, B4 (Q1, Q2, Q3) are color GREEN then Grade = PASS else Grade = FAIL
So, I need to check to see the color of Q1,Q2,Q3 and based on that put PASS or FAIL in GRADE cell. Any clues?
Thanks,
Try
=IF(COUNTIF(B2:B4,"green")>=2,"pass","fail")
This works when the cells have the text "Green" in them. It will not work if the cells have been colored with a fill color.
As a general rule: Color is not data. Many people run into problems when manually formatting cells with colors and then trying to aggregate this into information. Newer Excel versions have tools to filter and sort by format color in a table, but counting or summing by color is still not possible with Excel native formulas.
Instead of coloring cells, enter values. Enter the text values "Red" and "Green". Use conditional formatting to apply colors to cells based on their values. Then you can use formulas to aggregate (sum/count/average) by the cell values and still see the colors. The other benefit with conditional formatting is that the cell color changes immediately when the value changes from "Red" to "Green" for example.
There are two columns; the first contains four colored cells, while the second contains numbers. Is there any way to color the second column so that it matches the colors of the first column in the same order.
Eg. A1=Green, A2=Red, A3=Grey, A4=Black (COLORED).
B1=4, B2=3, B3=2, B4=1 (BLANK).
= A1=Green, A2=Red, A3=Grey, A4=Black (COLORED).
= B1=4 (Green), B2=3 (Red), B3=2 (Grey), B4=1 (Black) (COLORED).
Manually coloring the column will not work here because I want a cell in the second column to be able to match the cell next to it if its color changes. So for instance if a cell in column A changes from "black" to "red", I want the corresponding cell in column B to change from "black" to "red" automatically.
Eg. A1=Green, A2=Red, A3=Grey, A4=Red (COLORED).
B1=4 (Green), B2=3 (Red), B3=2 (Grey), B4=1 (Black) (COLORED).
Here A4 is now "red", while B4 is still "black". I want it so that if A4 changes color, B4 will change color to match A4.
I tried experimenting with conditional formatting, but that doesn't seem to be working out so far, would there be a formula for something like this, or am I SOL?
This is possible using Conditional Formatting.
You would have to select both columns and then choose to use a formula for the conditional formatting.
There you would input
=$A1="Red"
and set the formatting to red.
The $ fixes the formula to the first column. If you omit it, only column A would be colored in.
That way you would have to write the cell background color in column A, and if you set the font color to the same value you won't see it...
Another option would be to use a VBA macro, that runs on every SheetChange Event that will copy the background color from column A to column B
Edit:
As #lowak pointed out, you will have to create one rule for each color.