[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to Get Cell Format type?

Posted on 2004-09-13
8
Medium Priority
?
612 Views
Last Modified: 2012-06-22
Hi..

I am setting data type for the cells by

cellRightClick>>Selct Format cell>Select Number Tab>>Select data Type

How to I retrieve the type which I assigned for the cells..

e.g : if  I assigned

cell>>RightClick>>Format cell

cells(1,1) = "General"
cells(2,1) = "Number"
cells(3,1) = "Date"
cells(4,1) = "Currency"

How to I get retreived the Data type which I assigned thru wizard..

bye
0
Comment
Question by:ps_velan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
8 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 80 total points
ID: 12044201
Hi ps_velan,
The TYPE function returns the data type:
=TYPE(A1)      returns 1 for numeric, 2 for text, 4 for logical, 8 for formula, 16 for error, 64 for array

The CELL function returns the format:
=CELL("format",A1)         There are numerous return values--see the on-line help for their meaning

Cheers!

Brad
0
 
LVL 81

Expert Comment

by:byundt
ID: 12049554
ps_velan,
Here are the possible return values from =CELL("format",A1). This information is taken from the on-line Help. The value on the left is the Data type you assigned with the wizard; the value on the right is what the CELL function returns for that data type.

General "G"
0 "F0"
#,##0 ",0"
0.00 "F2"
#,##0.00 ",2"
$#,##0_);($#,##0) "C0"
$#,##0_);[Red]($#,##0) "C0-"
$#,##0.00_);($#,##0.00) "C2"
$#,##0.00_);[Red]($#,##0.00) "C2-"
0% "P0"
0.00% "P2"
0.00E+00 "S2"
# ?/? or # ??/?? "G"
m/d/yy or m/d/yy h:mm or mm/dd/yy "D4"
d-mmm-yy or dd-mmm-yy "D1"
d-mmm or dd-mmm "D2"
mmm-yy "D3"
mm/dd "D5"
h:mm AM/PM "D7"
h:mm:ss AM/PM "D6"
h:mm "D9"
h:mm:ss "D8"

If the info_type argument in the CELL formula is "format", and if the cell is formatted later with a custom format, then you must recalculate the worksheet to update the CELL formula.

Brad
0
 
LVL 81

Expert Comment

by:byundt
ID: 13362358
Of course in VBA you can get similar information with ActiveCell.NumberFormat
0
 

Expert Comment

by:pj071397
ID: 21792967
How to use the =CELL("format",A1) funtion? sample code in vb.net
0
 
LVL 81

Expert Comment

by:byundt
ID: 21793807
pj,
You would be better off posting a new question regarding the use of CELL function in VB.Net. The only people seeing your comment here are the participants in this question--and I do not use VB.Net and am therefore unable to offer a suggestion.

Brad
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question