+ 3
How to implement copy-paste in to the code?
Hi guys! So this is my first bit of code: https://code.sololearn.com/c7E10xTVhs69/#py It's well, useless for 99% of people, but useful for me. I'm working with a large amounts of ranges of telephone numbers in my work, which I have to count (sometimes). Ranges are often irregular so Instead of using calculator and writing the ranges down, I'd love to make it easier on me and my team and just copy paste the numbers from the text documents in the code, instead of putting the ranges in there manually. Also this is my first post here, I hope I'm doing so in the right section :D Guys any help would be greatly appreciated! Thank you
17 Antworten
+ 7
If you can get your data loaded in Excel, you have sorts, relative expression searches, and the ability to perform program like processing on the data.
+ 5
Exchanging emails or other personal information within SoloLearn is a violation of their guidelines.
+ 2
What type of text documents are you using? Also, would you mind typing out exactly what you're talking about in an example? I mean, typing out an example of the phone numbers and exactly what you're trying to do with them.
I'd be more than happy to help you out. Many ways we can go about this, but I want to make sure I'm 100% on what you're doing before I type something up for you.
Example:
555-5555
555-5556
555-5557
555-5558
555-5559
^5 numbers in the range of 555-5555 to 555-5559.
Like that?
+ 2
first of all, thank you for your willingness!
Yes it's more less like your example. I usually receive two types of spreadsheets with numbers, either like:
111-222-1000
111-222-1001
111-222-1002
111-222-1005
111-222-1006
111-222-1007
etc
Or as
111-300-1000 -> 111-300-1010
111-300-2500 -> 111-300-2579
and so on.
These are the two formats I'm working with.
The ranges matter only for last four numbers, so e.g. in the last case 2500 to 2579.
Thanks so much!
+ 2
Are these excel spreadsheets or do you have access to something like Excel? (could be OpenOffice, Google Sheets, etc... - anything that utilizes similar formula systems). You can easily do this in Excel.
EXAMPLE (based on cell columns A and B):
(column A)
111-222-1000
111-222-1001
111-222-1002
111-222-1005
111-222-1006
111-222-1007
(Column B)
=COUNTA(A:A)
^That'll count all of the cells in column A that are not empty. Change it to whatever cell range the numbers are in. (Example: COUNTA(A1:A200)) If they're in column by themselves, you can leave it A:A.
OTHER EXAMPLE::
111-300-1000 -> 111-300-1010
^Are those in their own cells or in one cell together? I can show you examples for both situations, but I'll assume they're in their own individual cells. Lets also assume the first number (lower in the range) is in cell A1 and the last number of the range (high end of range) is in A2.
=RIGHT(A1,4)-RIGHT(A2,4)
^That formula is going to take ONLY the last four digits of the numbers, and then subtract the high-end range from the low-end range. That'll give you the count for the range that only specifies the high/low number of the range.
If Excel, or keeping it isolated to the spreadsheet, isn't an option for you, then let me know and I can also type up some code for a standalone program that'll do same thing.
ALSO, if you're using Excel then you have access to VBA also. All of the above can also be done easily via code in the VBA editor of Excel.
Let me know how you want to approach it and I can help you out further with it. We may need to take this convo private to email though.
+ 2
@LemmeBoopThis
I'll be leaving work soon, but if you respond, I'll check it tomorrow. I have about 5 different ways in mind to help you out with this problem, and it'll depend upon what you're using currently to do your job. Hit me up when you read this - I can help you out with automating most of your job.
+ 2
@LemmeBoopThis
Sorry about delay. It's been a crazy day at work for me.
I can help you fully automate this process, if you want. There is a lot I want/need to ask you, and a lot that I need to say to help you out. Do you have an email address that I can use to reach out to you? I have a Gmail account, so if you do also we can talk in real-time and knock this out. I actually specialize in automation at some telecommunications company. lol I'll show you some neat stuff you can use to make your job insanely easier, especially since you're using Excel.
I'll wait until we can talk via email to further discuss this. Remind me to ask you more about your database/web portal; we may be able to make all of it communicate with one another so you can automate more of this process than not. I'll make sure you understand everything 100% so you can explain it to co-workers if needed (and hopefully get a promo? Eh? :) )
Hope to hear from ya soon!
+ 2
@John Wells
Thanks for the information and concern over my email getting out there. No worries though, this is an email that I use for SoloLearn and Stackoverflow, so I'm not much concerned over receiving spam emails there.
However, what guidelines are you speaking of? I've read the content guidelines and the terms of use for Sololearn and it doesn't mention that anywhere.
+ 2
@Filip Kudela
Okay awesome bro. Removing my email from post then.
+ 2
@Filip Kudela
Add me up bro and we can talk further about automation.
+ 2
@Filip
Ah, you're missing an R. :D
TRRainbow6
+ 1
Yes, I use excel as well. I didn't think of counting the ranges in there, good idea. Thanks!
The system works like this, we have an access to the database which was probably coded sometimes in 2000, as we have to run the software itself in emulated Win 2000 environment. From there, I'm copying the numbers in the format:
111-222-1000
111-222-1001
111-222-1002
111-222-1005
111-222-1006
111-222-1007
The format 111-300-1000 -> 111-300-1010, is 111-300-1000 in one cell and 111-300-1010 in another cell.
The main reason I tried to write the code, was to not only count but as well sort the ranges, as usually there is more of them and after I have all the numbers, and as they have to be written into another web tool, which has limitation on characters, therefore I wanted to code to sort the ranges as well. So after the multiple inputs and ranges, using the While loop, output produces something like: 1001->1002, 1005->1007, 2258->2350, etc. and a total number of TNs, in this case 98.
So after that I can just copy all the ranges and total, and paste it to the document needed.
Thanks a lot for your help! any ideas how to approach this?
+ 1
@Jakob Marley,
Sent you an email
+ 1
@Filip
Haven't received email quite yet. Once I get it, I'll send you some info your way. I'm at work so if I miss you during the day I'll take a look at it tonight and throw something together for you to learn from. I'll try to cover the various ways of doing it so you have more options now and in the future when you're doing other stuff.
+ 1
@Jakob
I've sent another one, hope you get it. TRainbow6 was it, right?
Thanks for all the efforts, I really appreciate it.
0
@Jakob
oooooh, alright fixed it :D