Assuming I have the following data in the sheet.
A
B
1
RED
1
2
GREEN
2
3
BLUE
3
4
COLOR
1
And I define names for B1, B2, B3, and B4 as RED, GREEN, BLUE, and COLOR, respectively.
Next I'm using a formula like below
MATCH(COLOR, {RED, GREEN, BLUE})
but Excel said formula error. I tried MATCH(COLOR, {1, 2, 3}) and it's ok.
So the question is, what's the correct way to use Name in lookup array?
Related
How do you do conditional formatting to find out if range 2 contains the text value from range 1? For example check for Apple in red apple should highlight it.
I need to compare A3:A6 with C3:C7. The end result should be C3, C4 and C5 highlighted.
A B C
1 Range1 Range2
==========================
3 Apple Red Apple
4 Orange Green Apple
5 Pear Orange
6 Watermelon Banana
7 Kiwi
I tried this formula but it only check B3 against Range2 and skips B4 to B6.
=FIND($B$3:$B$6,C3)>0
It is possible and I had fun working on this problem but I really wish you had done some work as well - seeing your own effort would have been just as rewarding as solving the problem by myself.
The formula to be used with conditional formatting is:
=NOT(ISERROR(AGGREGATE(15, 6, ROW($A$1:$A$4)/SEARCH($A$1:$A$4,B1), 1)))=TRUE
It obviously works as a normal, non-array formula too:
I am creating a template with 2 sheets in excel. Sheet 1 has the overall project status and sheet 2 has the list of projects with columns -Example B2 to H2 with Red and Green cell format.
If any of the cell in C2 to H2 is red for a particular project, then the overall project in sheet 1 is red. I used the following formula;
=IF(OR('Apr 6 Obeya worksheet'!$C$2="Red",'Apr 6 Obeya worksheet'!$D$2="Red",'Apr 6 Obeya worksheet'!$E$2="Red",'Apr 6 Obeya worksheet'!$F$2="Red",'Apr 6 Obeya worksheet'!$G$2="Red",'Apr 6 Obeya worksheet'!$H$2="Red"), "Red", "Green")
In the formula above, red is a true value and green is a false value.
So in sheet 1 the overall project status cell is highlighted in green when the cells C2 to H2 are not highlighted in Red or Green (Cells are blank)
What is the formula to use when the cells in sheet 2 (C2 to H2) are not highlighted and the cell (overall project status) in sheet 1 is not highlighted in green. I want that cell to have a default color (White)
I am using excel 16.
Thanks for your help.
I am trying to make a column do this: so lets say
If the score of 4 is made from a 2 x 2 then it is green.
If the score of 4 is made from a 4 x 1 or a 1 x 4 then it is yellow.
I am done the formula for the green and the yellow but it only happens once. So if I change a 2 x 2 to 4 x 1. It will stay green. Not change to yellow.
Formula for Green (2x2):
=IF(G31=4,IF(D15=2,IF(F15=2,0,1),1),0)
Formula for Yellow (4x1, 1x4):
=IF(G31=4,IF(D15=4,IF(F15=1,0,1),1),0)
Please help me work this one out. Thank you.
enter image description here
Tried the formula but does not work, even if I remove every other formula:
enter image description here
Use a combination of AND and OR
Formula for Yellow (4x1, 1x4) =AND($G31=4, OR($D15=1, $D15=4))
Formula for Green (2x2) =AND($G31=4, $D15=2)
EDIT
As per your screenshot, if you are trying to change a range, not just cell G31, use the following:
Formula for Yellow (4x1, 1x4) =AND($G1=4, OR($D1=1, $D1=4))
Formula for Green (2x2) =AND($G1=4, $D1=2)
Change the number 1 for the starting row of your cells (3, 4, 5 whatever) and set the Range to be =$G$1:$G$100 again changing the 1 and 100 for your start and end row.
I cannot stress enough, if your data does not start in row 1, you will need to edit the above to suit your needs.
Is there a way to count the number of distinct values in a filtered column in Excel?
Using the formula at https://exceljet.net/formula/count-unique-values-in-a-range-with-countif I can count the number of distinct values in a range, but when that range has been filtered with an auto-filter I still get the unfiltered count.
For example:
A B
1 Scarf Blue
2 Hat Red
3 Gloves Green
4 Coat Blue
5 Balloon Red
6 Shoes Blue
Counting unique values in B with =SUMPRODUCT((B1:B6<>"") / COUNTIF(B1:B6,B1:B6 & "")) should return 3 as the distinct values are Red, Green and Blue.
If I auto filter Column B to just select Red items, the resulting table will look like:
A B
2 Hat Red
5 Balloon Red
In this case the number of distinct values retuned should be 1. But the formula above still returns 3.
The formula should also cope with multiple selections in the auto-filter, so for example filtering for Blue and Green should result in the following table:
A B
1 Scarf Blue
3 Gloves Green
4 Coat Blue
6 Shoes Blue
From which the formula should return 2 (Blue, Green).
Finally, if I am filtering on column A rather than B, the formula should still work. So If I am only interested in Hat, Scarf and Coat, filtering column A for these values would result in:
A B
1 Scarf Blue
2 Hat Red
4 Coat Blue
From which the formula should return 2.
(I'm using Excel 2013 and need to do this in a formula rather than using VBA etc)
I also found this page on office.com which I thought might help, but alas I can't get it to work for me.
This reference shows how you can exclude hidden rows using AGGREGATE
Excluding hidden rows with AGGREGATE
You can then use a standard way of counting unique values like this
Counting unique values with FREQUENCY
So if you were counting values in column B, you would need a helper column (say C) containing
=IF(AGGREGATE(3,5,B2),B2,"")
Then plug in the form of count unique that ignores empty cells
=SUM(IF(FREQUENCY(IF(LEN(C2:C10)>0,MATCH(C2:C10,C2:C10,0),""), IF(LEN(C2:C10)>0,MATCH(C2:C10,C2:C10,0),""))>0,1))
Or your formula if you prefer
=SUMPRODUCT((C2:C10<>"") / COUNTIF(C2:C10,C2:C10 & ""))
Imagine I have a table like this:
| A | B | C
--------------
1 | 3 | 6 | 5
2 | 5 | 5 | 7
3 | 2 | 3 | 3
I want to:
Compare the values of the cells with the values of the cells above them
Color the background of the cell depending on this comparison
So:
If I compare the value of A2 to A1, 5 > 3, A2 should have a background of red
If I compare the value of A3 to A2, 2 < 5, A3 should have a background of green
If I compare the value of B2 to B1, 5 < 6, B2 should have a background of green
If I compare the value of B3 to B2, 3 < 5, B3 should have a background of green
If I compare the value of C2 to C1, 7 > 5, C2 should have a background of red
If I compare the value of C3 to C2, 3 < 7, C3 should have a background of green
Any ideas on how to do such a thing?
Thanks in advance and best regards,
Meibrah
To color the cells, select the range A2:C3 and choose from the home tab of the ribbon:
Conditional Formatting|Highlight Cell Rules|Greater Than...
with the settings shown, then repeat for Less Than... with Green Text.
In addition to the answer from Lori, I would like to add one more thing.
Instead of using 2 conditional format rules (red + green), just set the background color to your default (e.g. green) and use 1 conditional format rule to turn the cell red.