Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help with significant figure counter

I am trying to create a significant figure calculator, but I need some help.
I would like to do it with Built-in functions if possible.

I have formatted a column as text. The next is =FIND(".",A1), which will
return a number if a decimal was found. The next is =COUNT(B1).

Col C will be a Boolean (1 if there is a decimal, 0 if there is not).

If there is a decimal, I want to find the first non-zero digit from the LEFT
and count all digits from that one to the end (reading left to right). For
example, 0.0070 should ignore the 0.00 and count only the 70 on the right
(and show 2 for the number of sig figs).

If there is no decimal, I want to find the first non-zero digit from the
RIGHT and count all digits from that one to the end (reading right to left).
For example, 705000 should start on the right, skip the leading 0's and then
count the 5, the 0, and the 7 going right to left to return a value of 3.

I think I might have to create a VBA function, but I have limited experience
with that. If I did, I would set a flag (foundNonZero = 0), create a for
loop (for i = 1 to string.length) loop through until the first non-zero is
found, and then return string.length - i +1

If it did not have a decimal, I would loop from string.length to 1 instead.

Any suggestions?

Thanks!!

- Jeff

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Help with significant figure counter

Does this formula do what you want?

=LEN(ABS(SUBSTITUTE(A1,".","")))

--
Rick (MVP - Excel)


"Jeff Ciaccio" wrote in message
...
I am trying to create a significant figure calculator, but I need some
help. I would like to do it with Built-in functions if possible.

I have formatted a column as text. The next is =FIND(".",A1), which will
return a number if a decimal was found. The next is =COUNT(B1).

Col C will be a Boolean (1 if there is a decimal, 0 if there is not).

If there is a decimal, I want to find the first non-zero digit from the
LEFT and count all digits from that one to the end (reading left to
right). For example, 0.0070 should ignore the 0.00 and count only the 70
on the right (and show 2 for the number of sig figs).

If there is no decimal, I want to find the first non-zero digit from the
RIGHT and count all digits from that one to the end (reading right to
left). For example, 705000 should start on the right, skip the leading 0's
and then count the 5, the 0, and the 7 going right to left to return a
value of 3.

I think I might have to create a VBA function, but I have limited
experience with that. If I did, I would set a flag (foundNonZero = 0),
create a for loop (for i = 1 to string.length) loop through until the
first non-zero is found, and then return string.length - i +1

If it did not have a decimal, I would loop from string.length to 1
instead.

Any suggestions?

Thanks!!

- Jeff


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Significant figures Roger on Excel Excel Programming 1 November 18th 09 10:08 PM
3 most significant digits Gaba Excel Programming 4 October 19th 09 07:21 AM
HOW TO 'BLINK' A FIGURE INSTEAD OFF BOLDING THE FIGURE Nad.Engoor Excel Worksheet Functions 3 December 30th 08 03:04 PM
First significant figure Nige Danton Excel Worksheet Functions 14 December 14th 07 03:53 PM
Significant digits Marcus Excel Worksheet Functions 5 November 16th 05 03:39 PM


All times are GMT +1. The time now is 05:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"