ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Formatting a cell as "text" in the number catagory. (https://www.excelbanter.com/excel-worksheet-functions/7573-formatting-cell-%22text%22-number-catagory.html)

Ed

Formatting a cell as "text" in the number catagory.
 
I have a situation where cell D4 might contain either of the following
12 or A9
Another cell, H2, will contain the formula -
IF(D4=12,"yes",IF(D4="A9","no",""))
This formula deals with a cell that will contain either a number or an
alphabetic character. However the cells value will always be alphabetic.

Still another cell, H5, will contain the formula -
IF(D4=12,D4,IF(D4="A9",20,""))
This formula deals with a cell that will contain either a number or an
alphabetic character. This cells value might also be a number or an
alphabetic character.

Should cell D4 be number formatted as "general" or "text"?
Should cell H2 be number formatted as "general" or "text"?
Should cell H5 be number formatted as "general" or "text"?

With general format used for all cells, my macro stalls occasionally.
I think one or more of these cells are causing the problem.

Is text format the ideal format for any or all of these 3 cells?

Thankyou
Ed

Frank Kabel

Hi
use 'General' for this. Re your macro issue: You may post the code
which causes an error together with the exact error message

--
Regards
Frank Kabel
Frankfurt, Germany

"Ed" schrieb im Newsbeitrag
...
I have a situation where cell D4 might contain either of the

following
12 or A9
Another cell, H2, will contain the formula -
IF(D4=12,"yes",IF(D4="A9","no",""))
This formula deals with a cell that will contain either a number or

an
alphabetic character. However the cells value will always be

alphabetic.

Still another cell, H5, will contain the formula -
IF(D4=12,D4,IF(D4="A9",20,""))
This formula deals with a cell that will contain either a number or

an
alphabetic character. This cells value might also be a number or an
alphabetic character.

Should cell D4 be number formatted as "general" or "text"?
Should cell H2 be number formatted as "general" or "text"?
Should cell H5 be number formatted as "general" or "text"?

With general format used for all cells, my macro stalls occasionally.
I think one or more of these cells are causing the problem.

Is text format the ideal format for any or all of these 3 cells?

Thankyou
Ed



Ed

Hi
To further explore this "text" format catagory.
Can a number in a cell that is formatted as "text" be used in another cells
formula to calculate? In other words, can it be used as a part of a
comparison, or mathematical operation?
Thankyou
Ed

"Frank Kabel" wrote:

Hi
use 'General' for this. Re your macro issue: You may post the code
which causes an error together with the exact error message

--
Regards
Frank Kabel
Frankfurt, Germany

"Ed" schrieb im Newsbeitrag
...
I have a situation where cell D4 might contain either of the

following
12 or A9
Another cell, H2, will contain the formula -
IF(D4=12,"yes",IF(D4="A9","no",""))
This formula deals with a cell that will contain either a number or

an
alphabetic character. However the cells value will always be

alphabetic.

Still another cell, H5, will contain the formula -
IF(D4=12,D4,IF(D4="A9",20,""))
This formula deals with a cell that will contain either a number or

an
alphabetic character. This cells value might also be a number or an
alphabetic character.

Should cell D4 be number formatted as "general" or "text"?
Should cell H2 be number formatted as "general" or "text"?
Should cell H5 be number formatted as "general" or "text"?

With general format used for all cells, my macro stalls occasionally.
I think one or more of these cells are causing the problem.

Is text format the ideal format for any or all of these 3 cells?

Thankyou
Ed




Frank Kabel

Hi
you can use it but you have to convert it back to a numeric value
before you do it. e.g. with
VALUE(cell_ref)
or
--cell_ref

--
Regards
Frank Kabel
Frankfurt, Germany

"Ed" schrieb im Newsbeitrag
...
Hi
To further explore this "text" format catagory.
Can a number in a cell that is formatted as "text" be used in another

cells
formula to calculate? In other words, can it be used as a part of a
comparison, or mathematical operation?
Thankyou
Ed

"Frank Kabel" wrote:

Hi
use 'General' for this. Re your macro issue: You may post the code
which causes an error together with the exact error message

--
Regards
Frank Kabel
Frankfurt, Germany

"Ed" schrieb im Newsbeitrag
...
I have a situation where cell D4 might contain either of the

following
12 or A9
Another cell, H2, will contain the formula -
IF(D4=12,"yes",IF(D4="A9","no",""))
This formula deals with a cell that will contain either a number

or
an
alphabetic character. However the cells value will always be

alphabetic.

Still another cell, H5, will contain the formula -
IF(D4=12,D4,IF(D4="A9",20,""))
This formula deals with a cell that will contain either a number

or
an
alphabetic character. This cells value might also be a number or

an
alphabetic character.

Should cell D4 be number formatted as "general" or "text"?
Should cell H2 be number formatted as "general" or "text"?
Should cell H5 be number formatted as "general" or "text"?

With general format used for all cells, my macro stalls

occasionally.
I think one or more of these cells are causing the problem.

Is text format the ideal format for any or all of these 3 cells?

Thankyou
Ed






All times are GMT +1. The time now is 06:39 AM.

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