ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF function - If false argument query (https://www.excelbanter.com/excel-worksheet-functions/181808-if-function-if-false-argument-query.html)

Twishlist

IF function - If false argument query
 
I would like to fill cells with X, if they don't already have a letter in
them. I started to use the IF function, but am confused by how I should
treat the 'if false' argument. Some cells already have a C, or an R, and I
don't want to override the existing text.
=IF(" ","x",)
Should I be using a different function? Pity conditional formatting can't
return text

Max

IF function - If false argument query
 
On the face of it, you could try in B1, copied down:
=IF(TRIM(A1)="","X",TRIM(A1))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Twishlist" wrote:
I would like to fill cells with X, if they don't already have a letter in
them. I started to use the IF function, but am confused by how I should
treat the 'if false' argument. Some cells already have a C, or an R, and I
don't want to override the existing text.
=IF(" ","x",)
Should I be using a different function? Pity conditional formatting can't
return text


OssieMac

IF function - If false argument query
 
Not sure that I have interpreted your question correctly. =IF(" ","x",) Does
this mean if there is a space in the cell or is nothing in the cell?

Anyway, Dave Petersen had an answer a few days ago for a different reason
but referring to using the replace command whereby you can actually replace
nothing with something by simply leaving the Find what blank. However, if it
is a space then you can also replace that with something by typing a space in
the Find what field but ensure that you set the option to Match entire cell
contents.

Make sure that you back up your workbook before you attempt the above.

When testing the method I found that it would only work with the actual used
area of a worksheet. If you select a blank range on a new worksheet then the
find nothing failed. If you insert a character in the last cell of the area
to be selected then it worked. (Only tested with xl2007.)

--
Regards,

OssieMac


"Twishlist" wrote:

I would like to fill cells with X, if they don't already have a letter in
them. I started to use the IF function, but am confused by how I should
treat the 'if false' argument. Some cells already have a C, or an R, and I
don't want to override the existing text.
=IF(" ","x",)
Should I be using a different function? Pity conditional formatting can't
return text


Max

IF function - If false argument query
 
No prob. Happy to hear you got what you wanted.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Twishlist" wrote in message
...
Thanks for your response Max, but when I tried it, I got a FALSE result.
I
tried the find/replace option as suggested by OssieMac and it worked
beautifully for this purpose.




Twishlist

IF function - If false argument query
 
Thanks for your response Mac, but when I tried it, I got a FALSE result. I
tried the find/replace option as suggested by OssieMac and it worked
beautifully for this purpose.

"Max" wrote:

On the face of it, you could try in B1, copied down:
=IF(TRIM(A1)="","X",TRIM(A1))
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Twishlist" wrote:
I would like to fill cells with X, if they don't already have a letter in
them. I started to use the IF function, but am confused by how I should
treat the 'if false' argument. Some cells already have a C, or an R, and I
don't want to override the existing text.
=IF(" ","x",)
Should I be using a different function? Pity conditional formatting can't
return text


Twishlist

IF function - If false argument query
 
No I didn't have a space in the cell, just empty of content. Tried the
find/replace option and it worked perfectly for this purpose...don't know why
I didn't think of it. Thank goodness for this Discussion Group for dulled
minds like mine. Thanks heaps.

"OssieMac" wrote:

Not sure that I have interpreted your question correctly. =IF(" ","x",) Does
this mean if there is a space in the cell or is nothing in the cell?

Anyway, Dave Petersen had an answer a few days ago for a different reason
but referring to using the replace command whereby you can actually replace
nothing with something by simply leaving the Find what blank. However, if it
is a space then you can also replace that with something by typing a space in
the Find what field but ensure that you set the option to Match entire cell
contents.

Make sure that you back up your workbook before you attempt the above.

When testing the method I found that it would only work with the actual used
area of a worksheet. If you select a blank range on a new worksheet then the
find nothing failed. If you insert a character in the last cell of the area
to be selected then it worked. (Only tested with xl2007.)

--
Regards,

OssieMac


"Twishlist" wrote:

I would like to fill cells with X, if they don't already have a letter in
them. I started to use the IF function, but am confused by how I should
treat the 'if false' argument. Some cells already have a C, or an R, and I
don't want to override the existing text.
=IF(" ","x",)
Should I be using a different function? Pity conditional formatting can't
return text



All times are GMT +1. The time now is 03:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com