Question:
Excel: Calculate Width of String, not Length? 'Em' not 'Kearning'?
2011-09-13 11:17:36 UTC
I know to find the Length of a string, you can use the LEN() formula. Is there a way to calculate the Width of a string in pixels or some other units of measurement?

For example, look at these five letter words below, they all have the same number of letters, but because some letters are wider than others, the total width of the word on the screen/page is wider. Like, the capital letter W is wider than the capital letter I.

SILLY
FILES
INDEX
PRICE
WHITE
BUNNY
HARSH
RANGE
HORSE
AGGRO
WHALE

(you can see, depending on the font you're viewing this list in, that the words at the top of this list are slightly shorter in pixel or em width, and the words at the bottom are wider. if my phrase/string contains multiple wider characters, it throws me over limit)

My end result requires me to print all-caps text on a small tag, and I thought the LEN of 36 was the limit, but it actually depends on the width of each letter and if the phrase has too many wider letters, it runs off the page, regardless if it is less than 36 characters or not.

From what I hear, I'm looking for the "Em" measurement?
http://en.wikipedia.org/wiki/Em_(typography)

Any ideas?
Four answers:
expletive_xom
2011-09-13 11:47:39 UTC
MCV,

you obviously understand the difficulty

every font has its own width.

you need to find the width of every character



put your word in A1

one thing you can do is use the Scrabble formula



=SUM( 1*CHOOSE( CODE(MID( A1, ROW(INDIRECT("1:" & LEN(A1))), 1))-64, 1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10))



remember this is an array formula....so dont just hit enter...hit Ctrl Shift Enter and you will get curly bracket { and } around your formula



these points are for scrabble, correspond A to Z (note all uppercase).

you can also change the formula to replace the "scrabble points" with "pixels".



and it should just add it up for you

good luck



Edit-

Wow

the variable spacing between the letter...i didnt think about that (its even more difficult than i thought).

maybe VBA is the way to go, i dont know
?
2016-10-06 08:04:33 UTC
Kearning
2011-09-13 11:18:27 UTC
String theory is an active research framework in particle physics that attempts to reconcile quantum mechanics and general relativity.[1] It is a contender for the theory of everything (TOE), a manner of describing the known fundamental forces and matter in a mathematically complete system. The theory has yet to make novel experimental predictions at accessible energy scales, leading some scientists to claim that it cannot be considered a part of science.



String theory mainly posits that the electrons and quarks within an atom are not 0-dimensional objects, but rather 1-dimensional oscillating lines ("strings"). The earliest string model, the bosonic string, incorporated only bosons, although this view developed to the superstring theory, which posits that a connection (a "supersymmetry") exists between bosons and fermions. String theories also require the existence of several extra, unobservable dimensions to the universe, in addition to the four known spacetime dimensions.



The theory has its origins in an effort to understand the strong force, the dual resonance model (1969). Subsequently five different superstring theories were developed that incorporated fermions and possessed other properties necessary for a theory of everything. Since the mid 1990s, particularly due to insights from dualities shown to relate the five theories, an eleven-dimensional theory called M-theory is believed to encompass all of the previously-distinct superstring theories.



Many top theoretical physicists (e.g. Hawking, Witten, Maldacena and Susskind) believe that string theory is a step towards the correct fundamental description of nature. This is because string theory allows for the consistent combination of quantum field theory and general relativity, agrees with general insights in quantum gravity (such as the holographic principle and Black hole thermodynamics), and because it has passed many non-trivial checks of its internal consistency.[2][3][4][5][unreliable source?] According to Stephen Hawking in particular, "M-theory is the only candidate for a complete theory of the universe."[6] Nevertheless, other prominent physicists (e.g. Feynman and Glashow) have criticized string theory for not providing any quantitative experimental predictions.[7][8]
foobazbar
2011-09-13 11:20:50 UTC
Dont know if this is possible in excel. There is GetTextExtentPoint32() in Win32. Can you hook into that through Visual Basic or something through an excel macro?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...