#1   Report Post  
Posted to microsoft.public.excel.misc
Two-Canucks
 
Posts: n/a
Default Find nearest value

I have a column with diameters in thousands of an inch.
I need to find the nearest equivalent in fractions such as 1/64 1/128. The
fractions show as decimals in another column.

The fractions format only goes to 1/16 which is not small enough.
The match function gives an error.
Many thanks
--
Occasionally stumped
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default Find nearest value

Format the data as Fractions Up to three digits
--
Gary's Student


"Two-Canucks" wrote:

I have a column with diameters in thousands of an inch.
I need to find the nearest equivalent in fractions such as 1/64 1/128. The
fractions show as decimals in another column.

The fractions format only goes to 1/16 which is not small enough.
The match function gives an error.
Many thanks
--
Occasionally stumped

  #3   Report Post  
Posted to microsoft.public.excel.misc
Two-Canucks
 
Posts: n/a
Default Find nearest value

Formating the data as Fractions Up to three digits
does not help.

I need fractions in this format:
1/2^1; 1/2^2; 1/2^3; 1/2^4; 1/2^5; 1/2^6; 1/2^7;
i.e. Imperial measurements.
--
Occasionally stumped


"Gary''s Student" wrote:

Format the data as Fractions Up to three digits
--
Gary's Student


"Two-Canucks" wrote:

I have a column with diameters in thousands of an inch.
I need to find the nearest equivalent in fractions such as 1/64 1/128. The
fractions show as decimals in another column.

The fractions format only goes to 1/16 which is not small enough.
The match function gives an error.
Many thanks
--
Occasionally stumped

  #4   Report Post  
Posted to microsoft.public.excel.misc
Dana DeLouis
 
Posts: n/a
Default Find nearest value

Perhaps if you wish to work with an accuracy of say 1/(2^16) (1 / 65536)
then maybe ...
Numerator: =ROUND(A1*65536,0)
Denominator: 65536

--
HTH. :)
Dana DeLouis
Windows XP, Office 2003


"Two-Canucks" wrote in message
...
Formating the data as Fractions Up to three digits
does not help.

I need fractions in this format:
1/2^1; 1/2^2; 1/2^3; 1/2^4; 1/2^5; 1/2^6; 1/2^7;
i.e. Imperial measurements.
--
Occasionally stumped


"Gary''s Student" wrote:

Format the data as Fractions Up to three digits
--
Gary's Student


"Two-Canucks" wrote:

I have a column with diameters in thousands of an inch.
I need to find the nearest equivalent in fractions such as 1/64 1/128.
The
fractions show as decimals in another column.

The fractions format only goes to 1/16 which is not small enough.
The match function gives an error.
Many thanks
--
Occasionally stumped



  #5   Report Post  
Posted to microsoft.public.excel.misc
Herbert Seidenberg
 
Posts: n/a
Default Find nearest value

For denominators 2, 4, 8, 16, 32, 64 and 128,
depending on the closest match, as in these examples:

0.476823 61/128
0.513072 33/64
0.158690 5/32
0.689468 11/16
0.877029 7/8
0.746163 3/4
0.501050 1/2

Insert Name Define
input Refers to: 0.476823
bse Refers to: =2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1)
mult Refers to: =ROUND(input*bse1,0)/bse1
err Refers to: =ABS(input-mult)
merr Refers to: =MIN(err)

Paste this array formula into a cell next to input:
=INDEX(mult,MATCH(merr,err,0))
and Format Cells Fraction Up to 3 digits



  #6   Report Post  
Posted to microsoft.public.excel.misc
Two-Canucks
 
Posts: n/a
Default Find nearest value

Your example is indeed what I need. However, I could not
make the formula work.
I pasted the fractions in A8 to A14. The formula substitutions
gave me:
=INDEX(ROUND(.47682*2^(ROW(INDEX(A:A,1):INDEX(A:A, 8))-1),0)/2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1),MATCH(min(ABS(a1-ROUND(input*2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1),0)/2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1)),0))
which gave me the error Too few arguments.
Would it be simpler to place the 2^x fractions in a different column?
--
Occasionally stumped


"Herbert Seidenberg" wrote:

For denominators 2, 4, 8, 16, 32, 64 and 128,
depending on the closest match, as in these examples:

0.476823 61/128
0.513072 33/64
0.158690 5/32
0.689468 11/16
0.877029 7/8
0.746163 3/4
0.501050 1/2

Insert Name Define
input Refers to: 0.476823
bse Refers to: =2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1)
mult Refers to: =ROUND(input*bse1,0)/bse1
err Refers to: =ABS(input-mult)
merr Refers to: =MIN(err)

Paste this array formula into a cell next to input:
=INDEX(mult,MATCH(merr,err,0))
and Format Cells Fraction Up to 3 digits


  #7   Report Post  
Posted to microsoft.public.excel.misc
Herbert Seidenberg
 
Posts: n/a
Default Find nearest value

Your substitution formula contains several errors.
Although I don't recommend proceeding this way,
here is the correct formula:
=INDEX(ROUND(input*2^(ROW(INDEX(A:A,1):INDEX(A:A,8 ))-1),0)
/2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1),
MATCH(MIN(ABS(input-ROUND(input*2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1),0)
/2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1))),
ABS(input-ROUND(input*2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1),0)
/2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1)),0))
Substitute input with A8
otherwise you will get a #NAME? error.
Enter with CNTRL+SHIFT+ENTER

I recommend instead that you type the header
input
in cell A7,then select A7:A8 and
Insert Name Create Top Row
Q: Replace existing definition of input? A: Yes
then put my original array formula
=INDEX(mult,MATCH(merr,err,0))
into B8. Enter it with CNTRL+SHIFT+ENTER
instead of just ENTER.
If you get the correct answer, go to
Insert Name Define
and examine how input is now defined.
If you have problems giving names to the other values,
post again.

  #8   Report Post  
Posted to microsoft.public.excel.misc
Two-Canucks
 
Posts: n/a
Default Find nearest value

After correcting the formula I got the correct results.
Thank you.
Excel General Questions reply windows (unlike Excel Worksheet
functions or Excel programming) do not show
the rating bar at the bottom. How do I rate the reply?
--
Occasionally stumped


"Herbert Seidenberg" wrote:

Your substitution formula contains several errors.
Although I don't recommend proceeding this way,
here is the correct formula:
=INDEX(ROUND(input*2^(ROW(INDEX(A:A,1):INDEX(A:A,8 ))-1),0)
/2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1),
MATCH(MIN(ABS(input-ROUND(input*2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1),0)
/2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1))),
ABS(input-ROUND(input*2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1),0)
/2^(ROW(INDEX(A:A,1):INDEX(A:A,8))-1)),0))
Substitute input with A8
otherwise you will get a #NAME? error.
Enter with CNTRL+SHIFT+ENTER

I recommend instead that you type the header
input
in cell A7,then select A7:A8 and
Insert Name Create Top Row
Q: Replace existing definition of input? A: Yes
then put my original array formula
=INDEX(mult,MATCH(merr,err,0))
into B8. Enter it with CNTRL+SHIFT+ENTER
instead of just ENTER.
If you get the correct answer, go to
Insert Name Define
and examine how input is now defined.
If you have problems giving names to the other values,
post again.


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
use vlookup or other to find the nearest values (<) or interpola Rodney Excel Worksheet Functions 4 April 5th 06 09:21 PM
Rounding to the nearest quarter (decimal) in a Pivot table Fred Excel Discussion (Misc queries) 3 April 3rd 06 03:26 PM
Find and Replace blakrapter Excel Worksheet Functions 3 December 15th 05 12:25 AM
Code needed to find records from bottom up Andy Excel Discussion (Misc queries) 4 December 5th 05 03:27 AM
Excel has a "Find Next" command but no "Find Previous" command. Michael Fitzpatrick Excel Discussion (Misc queries) 2 January 10th 05 11:45 PM


All times are GMT +1. The time now is 09:20 AM.

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

About Us

"It's about Microsoft Excel"