Excel =if conditional question - excel

In Excel I need to do the following:
If cell A1 contains the text, "Toronto" then in B1 I need to put "X"
So I guess a formula in B1?

=IF(A1="Toronto","X","")
is the if format. if you are confused about excel formula's simply press the equals key in a blank cell and click the insert format command (Fx) and it will walk you through the formatting.

=IF(A1="Toronto","X",FALSE)
in B1, and replace FALSE with whatever you wish to put in the cell if it's not Toronto. If you simply want to leave it blank use "".

maybe in B1 if(A1 = "Toronto","X","Y")

If you want for Cell B1 to remain Blank unless A1 contains the text "Toronto" you could use the following formula in cell B1: =IF(A1="Toronto","X","")

Related

In excel, how to return nearest cell that contains date

I have a column that contains text cells and date cells. Next to each cell of text, I need the nearest cell that is above that text and contains a date to be returned.
Example
You can use INDEX/MATCH:
=IFERROR(INDEX($A$1:A1,MATCH(1,$A$1:A1,-1))/(ISTEXT(A1)),"")
You have to use a column agent (English is my second language so please give me a better way to describe it if you know), let's say column C.
Put this formula to C1:
=A1
Put this formula to C2 and fill down:
=IF(ISERROR(DATE(DAY(A2),MONTH(A2),YEAR(A2))), C1, A2)
The above formula check if A2 is a date then copy it or fill it down by the cell above.
Copy the cells you want in column B (B2:B4,...) from column C. Hide column C if you want.
Try below formula.
=IF(ISTEXT(A1),AGGREGATE(15,6,$A$1:$A$10,COUNTIF($A$1:$A1,">1/1/1900")),"")
If there are numbers also in cells rather that names then you can use below formula
=IF(LEFT(CELL("format",A1),1)="D","",AGGREGATE(15,6,$A$1:$A$10,COUNTIF($A$1:$A1,">1/1/1900")))
You can also use the LOOKUP function:
B1: =IF(ISNUMBER(A1),"",LOOKUP(2,1/($A$1:A1),$A$1:A1))
and fill down.

Can't subtract text of one cell from another

Is it possible to subtract text of a cell from another text of different cell? I meant to subtract text in B1 from text in A1 using excel formula.
Cell A1 contains:
FRIENDSWOOD CITY N 77546-4005
Cell B1 contains:
77546-4005
I expect the result in C1 which can be obtained subtracting A1-B1 using formula:
FRIENDSWOOD CITY N
I tried like the below one but it gives me value error:
=A1-(RIGHT(A1,LEN(A1)-FIND(" ",A1)))
Try using this formula:
=REPLACE(A1,FIND(B1,A1),LEN(B1),"")
Here's my result:
You could also try this simple formula,
=SUBSTITUTE(A1,B1,"")

Insert a value to a cell in excel using formula in another cell

I need to insert a value to a cell in excel using formula in another cell.
Say
A1 = "Test"
B1 = formula to insert A1 to C1
C1 = A1
Can I write a formula in B1 to insert value in C1?
I don't need any formulas in C1.
If Yes, What should be the formula?
If there it is next to the cell AND has no value in B2, it is possible, otherwise it is not.
Use Split()
Split(CONCATENATE("Text for B1#Sperator$$",A1),"#Sperator$$",FALSE)
It really depends.
EDIT
Out dated. Only works in google sheets.
Without using VBA or formulas in column C you can't achieve this.
A simple solution using formulas:
In cell C1, paste the following formula and drag it down:
=IF(B1=1;A1;"")
So if the content of cell B1 is equal to 1, your cell at column C will display the respective value of the same row at column A.

Conditionally format one cell based on values in a column

The user enters a date/time into cell B2. If this matches one of the values in column L I would like to format cell B2 as red, else format cell B2 as green.
Any idea how to do this?
Please format B2 green with standard fill, then apply the following Use a formula to determine which cells to format, Format values where this formula is true:
=match(B2,L:L,0)>0
with formatting (red) to suit and Applies to B2.
Assuming you are using Excel 2007 onwards:
Set cell shading for B2 = Green
Select Cell B2 and select the Conditional Formatting > New Rule menu item
Use a formula to determine which cells to format
In the formula bar, put in =ISNUMBER(MATCH(B2,$L$6:$L$100,0))
For format, change shading to Red
Obviously change the $L$6:$L$100 to suit you, but that should do it...
What about breaking this up into two steps.
Try putting a simple formula in Cell B1:
=ISNUMBER(MATCH(B2, L:L, 0))
This will return a TRUE if there's a match and a FALSE if there is not a match. Then make two conditional rules based on Cell B1.

Excel 2010: Set cell value to same value as other cell, even if cell is empty

In Excel 2010, I want cell A1 to have the same value as cell A2. So I set a formula in A1:
=B1
that works fine if B1 has a value. But, if B1 is empty, then A1 shows "0". I want A1 to be empty if B1 is empty.
As a workaround, I'm using the following formula in A1:
=IF(B1="", "", B1)
Is there an easier and more elegant way to set a cell to the same value as other cell? (without VBA)
That's the way Excel works I'm afraid. =B1 will display a zero if B1 is empty. Futhermore ISNNUMBER(B1) will return True. So it is a genuine zero, not something formatted as a zero.
A common workaround is to use something like:
=IF(ISBLANK(B1), "", B1)
which, I think, is more elegant than an empty string comparison.
Google spreadsheet works exactly as you need. Using
=A1
in B1, you get the desired empty B1 when A1 is empty.
Under Excel Options > Advanced > Display options for this worksheet, is a tick box called 'Show a Zero in Cells that have zero value'. If you un-tick it then your formula will display blank if they result in zero. Only downside is that all cells that have a zero value (not from a formula) will also display blank.

Resources