I need to use an IF function to determine if a cell is a percentage or not.
I have data that is a mix of % (cell is %) and normal data(Inlcudes decimal data). How could I differntiate between which is which using an IF?
Thanks
If all percentages are less than 100%, you could just do
=If(A2<1,"Percentage","Not %")
I '<3' reputation. If I helped, click the scales. This will be helping an internal departmental competition with co-workers.
Reputation can be granted through the Scales Icon (for classic layout), or the little Star on the bottom of the post next to the blogging function for the new forum layout.
If you're not busy, and really feel down on life, read my excel blog which may or may not have contents.
You need to test for the the number format unless the values are stored as text. You could use a udf like this:
Function GetFormat(myRange As Range) As String GetFormat = myRange.NumberFormat End Function
Dom
"May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."
Use code tags when posting your VBA code: [code] Your code here [/code]
Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.
You can also use formula like:
=IF(LEFT(CELL("format",A1))="P","Percentage","Other")
where A1 contains the number.
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks