How to change the colour fill the cell based in the drop list menu? - excel-2016

I have found out how to get the last occurrence of the selected name from a list in excel 2016. The problem is that I want to "highlight" or change the color fill of the cell that is in the criteria when I choose its name in the list.
This is my code:
=PROC(2;1/(C1:C199=P61);A1:A199)
In my spreadsheet the name is in the 'C' column and the data is in the A column.
What I need is only to know how to change the color like in the image below. The drop list name and data code I know how to do.
Link of the image: enter link description here
Thanks.

You can achieve that by applying a Conditional Formatting to the desired range.
Make sure to select Range("A2:B15"), and then go to:
Home > Conditional Formatting > New rule > Use a Formula to determine which cells to format
Write this formula, and choose a format:
=COUNTIFS($A2;$D$3;$B2;$E$3)>0
Click OK, and then Apply

Related

Excel Formula Cell Based on Background color

I need a formula in EXCEL that place a number 1 in the cell next to the cell where the cell background is RED. See example below.
Is this possible at all without VBA?
This can be done from Name Manager this can be accessed by pressing Ctrl+F3.
You will want to create a named reference (i called this "color") and have it refer to =GET.CELL(63,OFFSET(INDIRECT("RC",FALSE),0,-1)) in the formula bar.
Now you can use this 1 cell to the right to determine the color index number of a cell:
So as red is color index 3 in the cell next to it you can apply the formula:
=IF(color=3,1,0)
Open the VBA editor and add a new module. Do this by going to the Developer tab and clicking Visual Basic. If you don't have the developer tab on the ribbon you will need to add it (do a quick Google search). Once the VBA editor is open, right click on the VBA project which has your workbook name on the left and insert a module.
Place the following code into the new module:
Function IsRed(rng As Range) As Integer
IsRed = (rng.Interior.Color = vbRed) * -1
End Function
then you can use the formula =IsRed(A1) to determine if A1 has a red background
note: this uses the default red in the standard colours
You can achieve it manually without VBA using an autofilter:
Make sure you have a title above the column with colours and above the column where you want the value 1 placed
Add an Autofilter (Select both columns, click the Filter button on the Data tab of the ribbon)
Click the drop down filter on the column with colours, then click on Filter by Colour, the choose the Red colour
In your second column, enter a 1 in every visible cell. (Enter 1 in the first cell, then fill down. Or, select all cells, type 1 then press ctrl-enter)

Excel - Highlight Rows based on look up value from another sheet

Hi I have an excel sheet, that has a column called as Company name
in another sheet there is there are couple of look ups.. i need to look up those and highlight them in different colors based on the look up list.
for example, in the above scenario, i need Company A Highligted in oone color and company C in another.
If highlighting is challgeng, i dont mind even having a seperate coloumn next to it that says, if it is a partner or competitor.
i tried the below formula under conditional formatting .. but doesnt work for different colours... it colors everything the same
=NOT(ISNA(VLOOKUP(B1,'Lookup List'!$A$2:$D$200,1,FALSE)))
Please try selecting Company Name column and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=COUNTIF('Lookup List'!$A:$A,B1)
Format..., select colour Fill (highlight) of your choice, OK, OK.
Then repeat with:
=COUNTIF('Lookup List'!$B:$B,B1)
with a different fill.
If every entry is one colour or the other then one CF rule is sufficient, with the other colour applied as standard fill.

If content in a cell is too long, show "Multiple" instead of letting the text overflow in Excel

So, I have a custom function that concatenate different cells and put a comma between words.
For example, say I have "ABCD" "BC" then, this function will
output ABCD, BC. Now the problem is that the text will overflow in a cell and overlap with the cell next to that. In order to solve this problem,
I am thinking of just replacing the concatenated word with "Multiple" if more than 3 words are combined. Is there anyway to do this in a cell?
You can do this with conditional formatting AND keep the original underlying string as a raw value for other purposes.
Select the cells with the formula and create a conditional formatting rule based on a formula.         =LEN(C2)-LEN(SUBSTITUTE(C2, ",", ""))>1 
Click Format and go to the Numbers tab. Choose Custom from the list down the left side and supply the following for the Type:         ;;;[color13]_((\multipl\e)   I've opted to also make the font dark blue (colorindex # 13) and indent from the left.
Click OK to accept the formatting and then OK again to create the new rule.
        
As you can see in the sample image above, the underlying raw value remains (shown in the formula bar) but (multiple) is displayed.
More on custom number formatting codes at Number format codes

Change #N/A to Blank cell

How can I change the #N/A to the blank cell if nothing in that cell?
Eg. =VLOOKUP(B19:B36;$TABLE.A1:C46;2;0)
I think I might need something like an ISERROR check but I don't 100% know what I'm doing.
If we're talking about Excel 2010 and later you can use IFERROR:
=IFERROR(VLOOKUP(B19:B36;$TABLE.A1:C46;2;0);"")
You can also put text into the final string result
The question was misleading about the spreadsheet software as 2 different spreadsheets were originally stated in tags. However, it can be seen that the question is about OpenOffice Calc:
- Absolute sheet referencing ($ sign before the sheet name) is not possible in Excel.
- We also see a dot between the sheet name and the range, which is again not possible in Excel.
As in OpenOffice Calc you don't have IFERROR function, the only way is to repeat your main function twice in the following form (you can use both, ISNA and ISERROR, but I suggest ISNA as it's more specific and fits your case):
=IF(ISNA(YourFormula);"";YourFormula)
In your case something like:
=IF(ISNA(VLOOKUP(B19;$TABLE.A1:C46;2;0));"";VLOOKUP(B19;$TABLE.A1:C46;2;0))
You may want to make absolute reference to the range where you look for matching values, as I see you want to copy the formula down.
=IF(ISNA(VLOOKUP(B19;$TABLE.$A$1:$C$46;2;0));"";VLOOKUP(B19;$TABLE.$A$1:$C$46;2;0))
Since the cells will contain a formula this is about appearances, so Conditional formatting might suit, say if the cell background is white, for style choose Font > Font Effects > Font color white.
For this, select the relevant range - I have assumed D19:D36 - and Format > Conditional Formatting... and for Condition 1 choose Cell value is and equal to and:
ISNA(D19)

How to generate report

I have problem in generate report. I use crystal report 8.5 with vb.net 2008,what I want is when I generate report it will appear red value, if the value is more or less than actual value else it will give default value but when I put this code it give me wrong result
If {Intake.wheatType} = {Spec.WheatType} AND
{Intake.HB43} >={Spec.M_Min} AND{Intake.HB43} >={Spec.M_Max} Then
Red
Else
DefaultAttribute
this report is related with two tables, which is table Spec and table Intake. Could anyone help/teach me how to fix this problem
When determining whether a value is between a minimum and maximum, the logic will be:
Is the value greater than the minimum and is the value less than the maximum?
Actually you can create a Formula Field for that,
From Field Explorer, right click Formula Field
A popup window will appear, type the name of the formula you want.
in the Formula Editor insert you custome formula
Code:
If {Intake.wheatType} = {Spec.WheatType} AND {Intake.HB43} >={Spec.M_Min} AND {Intake.HB43} >={Spec.M_Max} Then
Red
Else
DefaultAttribute
Then click OK. Drag the newly created field on your report. And that's it.
For more info, see this: Adding Formula Field