+ Reply to Thread
Results 1 to 12 of 12

Excel formula to Extract Numbers Within a Defined Range

  1. #1
    Registered User
    Join Date
    03-01-2019
    Location
    Uk
    MS-Off Ver
    Office 365
    Posts
    5

    Excel formula to Extract Numbers Within a Defined Range

    Hi
    I haven't really used excel before so need help on something. I am trying to set up a table basically as follows; my table needs to have 3 columns. The first and second columns will have a number entered in between 0.0 and 64.0, the third column needs certain numbers within that range to be extracted into the 3rd column. These numbers also range from 0.0 to 64.0. The range needs to be able to change ie to 45.5 to 54.0 then the 3rd column will only extract the numbers between that range that need to be. Hope this makes sense
    Last edited by AliGW; 03-03-2019 at 08:13 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,446

    Re: Excel formula

    Hope this makes sense
    Sadly, not even close.


    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Excel formula

    Pending upload of a sample workbook as suggested by TMS, here is a guess. The more I think about it the more of a guess I think this is, but anyway, here goes . . .

    Questions:
    1. For a particular row, do both the col-A and col-B values need to be within the specified range or just one of cols A and B?
    2. If both cols A and B are within range then which number propagates to col-C?
    3. Or is there no meaning to be attached to the cells on a particular row and is Col-C just a list of all the numbers from either col-A or col-B that are within the specified range? If so then:
    • Can't cols A and B consolidated into a single column?
    • What about duplicates in cols A and B? Do they carry over into col-C or is col-C just to have unique values only?
    • Does col-C need to be sorted?

    Attached is a workbook allowing the MIN and MAX of the range to be propagated to col-C to be changed and is implemented with the following assumptions:
    • Col-C is just a list of all the numbers from either col-A or col-B that are within the specified range
    • No elimination of duplicates in col-C
    • No sorting of col-C


    Anywhere close to what you are looking for?
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-01-2019
    Location
    Uk
    MS-Off Ver
    Office 365
    Posts
    5

    Re: Excel formula

    I have attached my query. When you open it the taper button can be changed then all but end of work area is auto filled. I am looking for advice on how I need to use the data from the table (access) as a start point for blank table on the sheet, then I want to add the end of works to the new table. The next bit I want to make a list of numbers between the 2 ie 0.3 to 23.5 and highlight the overhead cable locations that are in that range in the final column. Any ideas

    Thanks in advance
    Attached Files Attached Files

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,850

    Re: Excel formula to Extract Numbers Within a Defined Range

    Your thread title has been updated to come into line with our forum rules. Please do not use vague and generic titles in future - they tell us nothing of the problem you are trying to solve. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Excel formula to Extract Numbers Within a Defined Range

    A few questions relating to your uploaded workbook:

    You have 3 worksheets ("1 lane out", "hard shoulder", "2 lanes out"). Can we focus exclusively on the "1 lane out" worksheet at least to begin with? Or are there inter-dependencies?

    Can you confirm that the goal is to populate the table in the upper right of the "1 lane out" worksheet (in the range H3 to J5)?

    Am I right in thinking that the intent is to determine whether there are overhead cables between the "Access" point and the "End of works?

    If so, then in your data there is only one "End of works" entry (cell B14 = 23.7), the corresponding "Access" is at 19.9. There are cables at 20 (are these all miles?) therefore your table should look as follows:

    roadworks.png

    If I am right, can you extend your sample with a few more data points - I'm still far from sure that I have enough of the story to provide a full answer.

    If I'm on the wrong track then please manually calculate and populate a few rows of your table and explain, in words, how you derived your table entries from the provided data.

    On a side track, I happened to notice that you have about 50 separate conditional formatting rules for cell B10 and another 50 for cell B11> I can't glean what you are trying to do, but if you could explain, then I'm sure there is an easier way. This is a secondary issue, so don't bother with it unless it's a quick and easy answer.

  7. #7
    Registered User
    Join Date
    03-01-2019
    Location
    Uk
    MS-Off Ver
    Office 365
    Posts
    5
    Thanks for the reply yes thats what i am trying to do highlight the cable area between like you have shown. The conditional format is for something else,that one highlights red when an unsafe location is entered as a taper location
    Thanks
    Last edited by AliGW; 03-05-2019 at 05:08 AM.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,850

    Re: Excel formula to Extract Numbers Within a Defined Range

    Please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.

  9. #9
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Excel formula to Extract Numbers Within a Defined Range

    I had asked in post #6: "can you extend your sample with a few more data points". Without that I'm still guessing.

    If I enter a different End-of-works distance in cell B14, say 36, then do you expect your overhead cable table to now look like:

    roadworks_revA.png

    You can now change cell-B14 and the Overhead cable table should automatically update.

    Is this what you are expecting? If so then is this the complete solution? If not then what else needs doing?

    If this is not what you expect then please tell me (at least) how you expect the overhead cable table to look in the event that cell A14 "End of works" is set to 36. Any additional clarifying information would also be welcome.

    A couple of details:

    1) Why do you have a gap in your Overhead Cable list at H21? I'm going to assume this is a typo and eliminate that gap.

    2) Back to the B10 conditional formatting where you have no less than 50 conditional formatting rules for that one cell. One example: 19.2 => red, 19.3 => green, 19.4 => red. Does this make sense? Just checking!

    Here's the formulas I applied to the three columns of the Overhead Cable table:
    In H4:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

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

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


    The attached workbook implements the above.

    Hopefully we're heading in the right direction.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    03-01-2019
    Location
    Uk
    MS-Off Ver
    Office 365
    Posts
    5

    Re: Excel formula to Extract Numbers Within a Defined Range

    Thanks that is exactly what i am looking for. The conditional formats are for locations where we cant start work due to location on the motorway,so if red we cant start,or green yes we can,probably an easier way to do it but not for a novice like me haha. I may hide the first two columns so it just shows overhead cable locations next.I think i will have to invest in a book or two and start learning. Thanks again for your patience with me on this

  11. #11
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Excel formula to Extract Numbers Within a Defined Range

    Rather than hide the first 2 columns you could simply delete them. The third column does not rely on them.

    Another thought - you could do away with the table entirely and use conditional formatting to highlight the cable distances of interest directly in your list of overhead cables. If you wanted to do that then select H14:H21 then Conditional formatting > Use a formula and enter the following formula: =AND(H14>$B$13, H14<$B$14)


    Your D10 conditional formatting (sorry I can't help myself!) If this is something that stays fixed for all time then fine - what you have works. If it needs to change regularly, I imagine it's a pain to update all your CF cases. An alternate approach would be to have a 600 row table, one row for each tenth of a mile. You could then simply put an "x" against each row or range of rows that were unsafe areas. With that approach you could have just one single CF rule for D10 that would look something like: =VLOOKUP($D$10, $M$2:$M$600, 2, FALSE)="x". I can provide more specifics if you need.

    That all said, if you are happy that your questions has been resolved then can you please mark the thread as solved, To do this select Thread Tools from the menu link above and mark this thread as SOLVED. If you have additional questions you can start a new thread.

  12. #12
    Registered User
    Join Date
    03-01-2019
    Location
    Uk
    MS-Off Ver
    Office 365
    Posts
    5

    Re: Excel formula to Extract Numbers Within a Defined Range

    Yes they are fixed and never need to be changed,ha ha i was proud it worked at the time. Thanks for further advice .....i may have a little tinker about.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA, User-defined formula argument referring to cell value calculated by Excel formula
    By ARAGORN II in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2017, 01:57 PM
  2. Excel formula bar to display the result of the formula , not the formula?
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-18-2016, 07:15 PM
  3. Replies: 10
    Last Post: 12-16-2015, 03:16 PM
  4. Replies: 2
    Last Post: 03-21-2014, 11:43 AM
  5. Macro: Applying formula to multiple cells in excel (formula editing)
    By city in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-27-2012, 06:41 AM
  6. Replies: 0
    Last Post: 03-19-2012, 07:32 PM
  7. Replies: 1
    Last Post: 03-04-2012, 12:03 AM

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