how to create an excel formula with vlookup and if argument - excel

I want to create a formula that looks up for a specific text in the range in provide or column and if it finds the text, write that text or the text in the right column in another cell. I am currently using this formula:
=LOOKUP("Haider",O11:O16,E1:E6)
However even when it can not find Haider in the range O11:O16, it still writes the text in the column E1:E6 to the cell in which I wrote the formula.
Also, as there would be only a single word in the entire column at one time, you
could help me with a formula that simply copies that word to a cell of my choice.
Another question is that how can I combine this with conditional formatting? For example, if I want to find the text and if it is found the range I specify, it should turn another cell into red or any color.

The first part of your question is answered in the comment from Byron Wall.
For the second part of the question, if you want to find the first or only cell containing text in a range, the formula is:-
=IFERROR(VLOOKUP("*", O11:O16, 1,FALSE),"")
If you want to find the first or only cell containing anything, the formula is
=IFERROR(INDEX(O11:O16,MATCH(TRUE,O11:O16<>"",0)),"")
but you have to enter it as an array formula using Ctrl-Shift-Enter.
For the last part of the question, supposing you wanted to highlight the cell in E1:E6 corresponding to the cell in O11:O16 containing "Haider", you would need the formula:-
=$O11="Haider"
(this compares E1 with O11, E2 with O12 etc. because of relative addressing)
Highlight E1 to E6.
Go to 'Conditional Formatting'.
Select 'New Rule' and 'Use a formula...' , enter the formula and choose a fill colour in the Format option.

Related

Looking up the value of cells above a cell

thank you for reading this.
I have a row containing a list of text.
APA
VEN
GRAB
I have a table containing either I or Super. Below the table, there are corresponding text such as APA, VEN, GRAB or blank formula cells.
I want to get the cells above a non-blank formula cell. For example, in the row APA, VEN, GRAB that I have..
I want APA to return the value of 5 cells above it. I know how to return one value above it (i.e. Super), but I am not sure how to get the 4 cells above Super.
APA I I I I Super
VEN
GRAB
Edit: =INDEX(AZ53:BA57,MATCH(BA58,BA53:BA57,0)-1,0) This is what I tried to return the cell above APA. I am trying to figure out how to return the 5 cells above APA.
I know I can enter formula to each cell. I wanted to do it in a formula if possible. Thank you again.
=INDEX(AZ53:BZ57,MATCH(BA58,BA53:BA57,0)-2,0)
=INDEX(AZ53:BZ57,MATCH(BA58,BA53:BA57,0)-3,0)
=INDEX(AZ53:BZ57,MATCH(BA58,BA53:BA57,0)-4,0)
=INDEX(AZ53:BZ57,MATCH(BA58,BA53:BA57,0)-5,0)
enter image description here
Answer based on inital question
Cell F10 contains the following formula =INDEX(F:F;ROW(F$10)+INDEX($C$2:$C$4;MATCH(F$9;$B$2:$B$4;0))-1) which has then be copied to G10 and I10.
I used the area B2:C4 to define the negative offsets for your non-blank content. As the field in which I display the result of the formula is one row below your non-blank content I added an additional -1 to the formula.
The grey numbers and the yellow highlights have been used to quickly validate the outcome.
Update based on questioner's comment
According to your instructions, source ranges (purple) would intersect with target ranges (blue), see cells with red border.
As it is not possible to put both a formula and a value into the same cell, I assumed that you wanted to explain independently
how the target should be structured and
how the source should be structured.
Hence, it looks like you are looking for a formula that transposes your values from columns into rows.
In the above image, the highlighted cells contain the following formula (example for cell S14):
=OFFSET(source_anchor,COLUMN(S14)-COLUMN(target_anchor),ROW(S14)-ROW(target_anchor))
source_anchor refers to cell Q3
target_anchor refers to cell R13
Please let me know if this is what you are looking for. If it is not the case, then please provide a mock-up.

custom format cell in excel

I have a question about custom format cell , Which codes or characters in custom format cell should I use that when I copy a formula from another cell and paste in formatted cell then the result of formatted cell (displayed number) does not change and remain as before pasting?
More explanation
Suppose we have a table where the third column is the product of the first column multiplied by the second.
Then we change one of the cells of the third column using the custom format cell and the character “apple” as follows.
Now if we copy the second row cell of the third column and paste it in the fifth row cell of the third column, the word apple changes to the number 15.
My question is what character instead of “apple “ to use in the custom format cell that does not change the word apple after copying the second row of the third column and pasting in the fifth row of the third column? (for example add the characters "#*., # and etc. with apple may be was the answer
I had two fields with floating point numbers which are divided by each other and the result of the calculation displayed on cell C1. I then copied the same two values down to the second row. I formatted cell C2 to use numeric format with two decimal values only. Lastly, I proceeded to copy the formula on C1 and paste it on cell C2 using "Paste Special --> Formula." You can see the cell format was preserved.
I don't understand this question because it lacks basic context. However, I think I was able to demonstrate that I was able to do what the OP said without "result of formatted cell not changing and remaining as before pasting."
UPDATE:
The example below shows a cell with a custom format of "apple" that formerly contained the formula a*b. After copying the contents of cell B2, I used "Paste Special" to paste the VALUE (nothing else) into cell B5. As you can see in the top-right of the image, the cell contains the value "2" but the custom format of "apple" is preserved.
Obviously, this is not a good example. Suppose that, instead of a custom format of "apple" I format that cell to contain a special format where I want to show a leading zero (if value is single digit) as well as two decimal places. The result is the same. The special formatting is preserved by "specially pasting" something other than the format of the cell.
If I repeat the same process as before, I can paste the value of "2" but it will be presented using the special (custom) format that I had before on the cell, because in Excel, the paste operation copies the value as well as all the metadata of the cell. To avoid this, "PASTE SPECIAL" is the option.
That said, there might be a way of protecting the worksheet to prevent formatting to be overridden in a paste operation. Since I am not an Excel super-user, I don't know if there is a way to lock this information globally. I assume there is a way, but I just don't know it.

How to Apply Conditional Format to show a field is mandatory to be filled in based on a vlookup to another sheet

I'm trying to create a form in excel for my team to fill out which highlights certain cells in a row as compulsory (format the cell colour) based on the number from a table in another sheet which has 3 preset dimensions ("M"=Mandatory, "P"=Prohibited, "O"=Optional) for each number across multiple analysis field.
I have tried conditional formatting formulas to highlight the cell to fill out if the lookup of the number chosen returns "M") but I don't seem to have a formula which validated this and returns with the cell highlighted when it needs to completed.
I would like the formula to return the cell as highlighted if it is mandatory based on the lookup to the table and need the user to fill out the cell with the information relevant.
Any help would be much appreciated.
If I understand your question correctly you just want the cell to highlight when its sister cell in another sheet is coded "M". That's a fairly easy formula.
=Sheet2!$B1="M"
This is for a straight column in B, where the cell it's checking against is in sheet 2 and also in column B. If it's for a row simply move the $ to say b$1.
If you want the highlight to disappear when the cell is filled in use this formula:
=AND($B1=0,Sheet2!$B1="M")

Conditional Formatting for a row when there is a text disagreement between two cells

I'm working on a conditional formatting issue. I would like the whole row to highlight if the text in the same row in columns B and C disagree. So far, I've been able to write conditional formatting rules that leave the cell un-touched if there is no data and if there is a data entry that disagrees with the text in Column B, but I can't seem to get the formula to apply to the full row.
Here is what I currently have:screenshot of the document with conditional formatting rules visible
I'm working on Excel 2010. Maybe there is a way to use a logic formula?
I look forward to hearing suggestions!
You can do this with a formula. Highlight the range you would like to format, create a new conditional format, select "Use a formula..." and enter the formula as it would apply to the first cell or in this case row.
In my case, I chose the first 6 rows: $1:$6 as my range. So in this case, I would enter the formula as if I were only entering it for my first cell. The formula =$B1<>$C1 will check for inequality between B1 and C1 in the first row, B2 and C2 in the second row, and so on.

Substitute text in a formula for text from a cell

I am trying to substitute a specific part of a formula for the text contained in a different Cell.
The formula is:
=SUMIFS(Data!$C$2:$C$300000,Data!$O$2:$O$300000,"c285",Data!$G$2:$G$300000,">"&DATE(2017,1,1))
This formula is the same all the way down my spreadsheet although it should only be in cell O1. I want to change the part of the formula that says "c285" to match the value in the cell in each row
Is there a way to do this without me doing it manually?
The forumula can be seen in all the cells in Column O, they are all the same as they all have the same formula at the moment
Route 1:if you want to do it programmatically -> take a net language of your choice
take the cell content, search for the position of C1, change that to C +iterator
save it to the cell
Route 2: change the first few cells, delete the rest. Select all the correct cells, click on the right corner, pull down till you got all your rows auto completed
(this works for simple formulas, dates and so on. You would have to test this)
And always have a backup copy

Resources