Solved

Formula Explanation

Posted on 2014-03-19
6
329 Views
Last Modified: 2014-03-19
Hi Experts,


Just need to know how This  formula works. what is the logic behind this.

Column A
50MB
60 KB
6.1 GB
60KB
223MB


Formula in B1
=SUMPRODUCT(LEFT(A1:A5,LEN(A1:A5)-2)*1024^(MATCH(LEFT(RIGHT(A1:A5,2)),{"K","M","G","T"},0)))/1024^3

Open in new window



Thank you
0
Comment
Question by:Naresh Patel
[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
  • 3
  • 2
6 Comments
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 39941549
SUMPRODUCT is an array formula. It looks for any arrays included as parameters and then expands them.

=SUMPRODUCT(LEFT(A1:A5,LEN(A1:A5)-2)*1024^(MATCH(LEFT(RIGHT(A1:A5,2)),{"K","M","G","T"},0)))/1024^3

This part:

LEFT(A1:A5,LEN(A1:A5)-2)

is pulling the numeric part of the string. It assumes that the only text in the string will be at the end and contain only two characters. Trailing spaces are ignored when converting a string of numbers to a numeric value.

This part:

1024^(MATCH(LEFT(RIGHT(A1:A5,2)),{"K","M","G","T"},0))

Is taking a power of 1024. The power is determined by result of the MATCH function which returns the index of the value matched. In this case the formula is pulling the second to the last character in the cell's value and matching it to the array of single characters. The result is a 1, 2, 3, or 4 which, when 1024 is raised to that power, adjusts the value to KB.

The final part is to divide the total by 1024^3 which converts KB to TB.

Kevin
0
 
LVL 5

Expert Comment

by:jayakrishnabh
ID: 39941560
Final part to convert to GB, rest all as Kevin explained.
0
 
LVL 8

Author Comment

by:Naresh Patel
ID: 39941561
Mr.zorvek (Kevin Jones),

Thank You For Replying.

The final part is to divide the total by 1024^3 which converts KB to TB.

Final Result Is "6.366716" By Applying This Formula. So It Is 6.366716 TB? I Guess It Is 6.366716 GB.

Thanks
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 39941566
Yes, I believe you are correct.

Kevin
0
 
LVL 8

Author Comment

by:Naresh Patel
ID: 39941567
Opps I dint Refresh The Browser Before Posting.

Thanks
0
 
LVL 8

Author Closing Comment

by:Naresh Patel
ID: 39941569
Awesome New Thing Learned !!!
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

696 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