+ Reply to Thread
Results 1 to 13 of 13

theoretical size question

  1. #1
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    theoretical size question

    hi all
    just a theoretical question really
    would excel be able to work this out?

    in cell a1 i have 1-5
    b1 i have 6-9

    in a2 i have £4.99
    in b2 i have £9.99

    if in cell d1 i input the number 4 would it be able to understand that 4 is in the group 1-5? and should produce £4.99 in cell d2?

    thanks
    if it is possible and you could point me the right way ti would be appreciated
    Last edited by excellentexcel; 01-16-2009 at 04:39 PM.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Sure, many things are possible in Excel. Here is one solution, although there may be a more simple method:

    =SUMPRODUCT((D1>=VALUE(LEFT(A1:B1,SEARCH("-",A1:B1)-1)))*(D1<=VALUE(MID(A1:B1,SEARCH("-",A1:B1)+1,1^99)))*(A2:B2))

    HTH

    Jason

  3. #3
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    wow thanks jason
    i really didnt think it tould understand that
    thanks for your help

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Glad it helped.

  5. #5
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    An alternative approach can use vlookup's "closest match" (the "true" in the vlookup - check Help for details). Type 1 into cell A1 & 6 into cell A2 and put this formula into D2
    Please Login or Register  to view this content.
    At the moment, anything greater than 6 will return 9.99, but the result could be changed by typing 10 into cell A3 & "please enter a number between 1 & 9" into cell B3, then changing the D2 formula to
    Please Login or Register  to view this content.
    . This effectively"caps" the input range.

    hth
    Rob
    Last edited by broro183; 01-16-2009 at 05:49 PM. Reason: typo
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  6. #6
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    You meant HLOOKUP, right, Rob?

  7. #7
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    jason just as an update
    i need some help along the same lines if you would be so kind

    if i needed to enter a number in cell e1 and there is a y in cell h1 it would need to return the red section in this case £9.99

    but if there was an n in cell h1 it would need to return the yellow section which in this case would be £1.99

    any ideas please

    please find attached
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    540
    You can achieve this by modifying the existing formula to the following:

    Please Login or Register  to view this content.
    Hope this helps.

  9. #9
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415
    quality

    thanks thats perfect

  10. #10
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    540
    You're welcome and thanks for the feedback!

  11. #11
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    This thread is tagged, bagged & solved but just to clarify for Jason...

    Quote Originally Posted by jasoncw View Post
    You meant HLOOKUP, right, Rob?

    Nope, I do mean VLookup - try out my suggestion (or view attachment) & you'll see that it works (& will work for any sized list of numbers as long as they are in ascending order)...

    As the Excel 2003 Help Files state for Vlookup:
    Searches for a value in the leftmost column of a table, and then returns a value in the same row from a column you specify in the table. Use VLOOKUP instead of HLOOKUP when your comparison values are located in a column to the left of the data you want to find.
    The V in VLOOKUP stands for "Vertical."
    Rob
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Sorry for the confusion, Rob. I was assuming you were leaving the data as arranged by the OP (lookup values in row 1, results in row 2), which would require HLookup instead of VLookup.

  13. #13
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    Good as gold Jason (no need to apologise ) - on re-reading my initial post I see I was not as clear (or complete) as I could have been.

    Rob

+ 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