+ Reply to Thread
Results 1 to 9 of 9

HLOOKUP to get exact number formatting?

  1. #1
    Registered User
    Join Date
    03-13-2013
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    44

    HLOOKUP to get exact number formatting?

    Hi.
    I got big table with various metrics, where all of them are generally 4 types:
    Currency
    Number
    Percentage
    Text

    i seen no problem then Hlookup delivers me currency, but in other cases, sometimes I need to get the output in the same number format as the source in table:

    if the data in source table row is percentage, i need to have an output as percentages.
    if the data in source table row is general number, I need to have an output as general number.
    If the data in source table row is currency, I need to have an output as currency.

    At the moment, if I have a table with outputs and will put general number formatting, i can have the result, where instead of 16% I will see 0.16.

    the problem is, that I cannot pre-set the formatting for the output cells, because users will define the type of number format in the table later. for example, for one department, which will use my file, it might be that lets say line 5 in table will have data as currency. For other department, the line 5 might be % of anything and they will show percentages in the same line 5.

    if there any way I could have the formatting dependable on the source formatting?
    File attached
    Book43.xlsx
    Last edited by yessuz; 04-25-2013 at 07:53 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: HLOOKUP to get exact number formatting?

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Last edited by martindwilson; 04-25-2013 at 07:36 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    03-13-2013
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: HLOOKUP to get exact number formatting?

    file attached.
    data is dummy data, but it generally shows the issue.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: HLOOKUP to get exact number formatting?

    are the entries governed by the kpi?

  5. #5
    Registered User
    Join Date
    03-13-2013
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: HLOOKUP to get exact number formatting?

    Quote Originally Posted by martindwilson View Post
    are the entries governed by the kpi?
    in general - yes. The type of entries (KPI name and type of data) would depend on the department which will use the file.
    i.e. sales department would, most probably, have all entries as currency in thousands of pounds; while production dept. would probable have few lines as %, other lines as regular number (i.e. days of delays) etc.

    and the problem is, that I cannot predict which exactly type of data (and KPI) would be used, as my KPI database has like 500 entries...

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: HLOOKUP to get exact number formatting?

    well it could probably done with a load of address/indirects and ifs

    =IF(CELL("format",INDIRECT(ADDRESS(4,MATCH(Sheet1!$B$1,Sheet2!$A$1:$P$1,0),,,"sheet2")))="C0",TEXT(HLOOKUP($B$1,Sheet2!$D$1:$P$25,9,FALSE),"£#,##0k;(£#,##0k)"),if(..............
    but you'd probably be beter of trying to get someone to code it in vba

  7. #7
    Registered User
    Join Date
    03-13-2013
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: HLOOKUP to get exact number formatting?

    I imagine that VBA would do the magic, but initial target was to avoid VBA as much as possible

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: HLOOKUP to get exact number formatting?

    Try this in d4 filled down(note it uses the value of the kpi in col b to get the correct cell)

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-13-2013
    Location
    uk
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: HLOOKUP to get exact number formatting?

    thank you! gonna check the outcome

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1