Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 142
Default How do I consolidate data into ranges

I need to consolidate data from 2 columns. Column A has over 40,000 unique
values, Column B has only 5. I need to consolidate Column A into ranges. I.e.
1 thru 1000 = 1. 1001 thry 1250 = 2. 1251 thru 2500 = 1. etc.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 192
Default How do I consolidate data into ranges

Maybe I'm not understanding correctly, but if you follow this if statement it
can give you what you stated below.

=IF(A1<1001,1,IF(A1<1251,2,IF(A1<2501,3,IF(etc.))) )

This what you're looking for?
--
-SA


"Jerry" wrote:

I need to consolidate data from 2 columns. Column A has over 40,000 unique
values, Column B has only 5. I need to consolidate Column A into ranges. I.e.
1 thru 1000 = 1. 1001 thry 1250 = 2. 1251 thru 2500 = 1. etc.
Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 142
Default How do I consolidate data into ranges

Sorry, allow me to clarify. The first column is zip code ranges, and the
second column is transit times (# of days). I need to consolidate all the zip
codes into ranges as opposed to a huge list of zip codes.
Thanks

"StumpedAgain" wrote:

Maybe I'm not understanding correctly, but if you follow this if statement it
can give you what you stated below.

=IF(A1<1001,1,IF(A1<1251,2,IF(A1<2501,3,IF(etc.))) )

This what you're looking for?
--
-SA


"Jerry" wrote:

I need to consolidate data from 2 columns. Column A has over 40,000 unique
values, Column B has only 5. I need to consolidate Column A into ranges. I.e.
1 thru 1000 = 1. 1001 thry 1250 = 2. 1251 thru 2500 = 1. etc.
Thanks

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 142
Default How do I consolidate data into ranges

The figures 1 thru 1000 were an example, I need a formula to create the
actual range based on the value in Column B.

"StumpedAgain" wrote:

Maybe I'm not understanding correctly, but if you follow this if statement it
can give you what you stated below.

=IF(A1<1001,1,IF(A1<1251,2,IF(A1<2501,3,IF(etc.))) )

This what you're looking for?
--
-SA


"Jerry" wrote:

I need to consolidate data from 2 columns. Column A has over 40,000 unique
values, Column B has only 5. I need to consolidate Column A into ranges. I.e.
1 thru 1000 = 1. 1001 thry 1250 = 2. 1251 thru 2500 = 1. etc.
Thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 192
Default How do I consolidate data into ranges

Perhaps a quick "this is what I have" and "this is what I want" would help.
I.e.

What I have:
Zipcodes Transit Times
94534 4
65481 5
etc.

What I want:
??

I guess I'm confused on what you're looking to get out of it. Do you want a
count of all the ranges between certain values? How are you looking to
consolidate these zip codes?

I'm not sure this is what you're looking for but perhaps a slight
modification to what I posted befo

=IF(A1<1001,"1-1000",IF(A1<1251,"1001-1250",IF(A1<2501,"1251-2500",IF(etc.))))

Let me know!
--
-SA


"Jerry" wrote:

The figures 1 thru 1000 were an example, I need a formula to create the
actual range based on the value in Column B.

"StumpedAgain" wrote:

Maybe I'm not understanding correctly, but if you follow this if statement it
can give you what you stated below.

=IF(A1<1001,1,IF(A1<1251,2,IF(A1<2501,3,IF(etc.))) )

This what you're looking for?
--
-SA


"Jerry" wrote:

I need to consolidate data from 2 columns. Column A has over 40,000 unique
values, Column B has only 5. I need to consolidate Column A into ranges. I.e.
1 thru 1000 = 1. 1001 thry 1250 = 2. 1251 thru 2500 = 1. etc.
Thanks



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 142
Default How do I consolidate data into ranges

This is what I have:

Zipcodes Transit time
00501 5
00502 5
00503 5
11001 1
11002 1

I need to replace this with:

Zipcode Ranges Transit Time
00501 - 00503 5
11001 - 11002 1

Thank you for all your assistance

"StumpedAgain" wrote:

Perhaps a quick "this is what I have" and "this is what I want" would help.
I.e.

What I have:
Zipcodes Transit Times
94534 4
65481 5
etc.

What I want:
??

I guess I'm confused on what you're looking to get out of it. Do you want a
count of all the ranges between certain values? How are you looking to
consolidate these zip codes?

I'm not sure this is what you're looking for but perhaps a slight
modification to what I posted befo

=IF(A1<1001,"1-1000",IF(A1<1251,"1001-1250",IF(A1<2501,"1251-2500",IF(etc.))))

Let me know!
--
-SA


"Jerry" wrote:

The figures 1 thru 1000 were an example, I need a formula to create the
actual range based on the value in Column B.

"StumpedAgain" wrote:

Maybe I'm not understanding correctly, but if you follow this if statement it
can give you what you stated below.

=IF(A1<1001,1,IF(A1<1251,2,IF(A1<2501,3,IF(etc.))) )

This what you're looking for?
--
-SA


"Jerry" wrote:

I need to consolidate data from 2 columns. Column A has over 40,000 unique
values, Column B has only 5. I need to consolidate Column A into ranges. I.e.
1 thru 1000 = 1. 1001 thry 1250 = 2. 1251 thru 2500 = 1. etc.
Thanks

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 192
Default How do I consolidate data into ranges

OOhh... well then... I would use the following in VBA. I used it on a quick
test string and it worked for me. Let me know how it goes!


Option Explicit
Sub consolidation()

Dim transit, zipcode1, zipcode2 As Range

Set transit = Range("B2")

Do Until transit.Value = ""
Set zipcode1 = transit.Offset(0, -1)
Do Until transit < transit.Offset(1, 0)
Set zipcode2 = transit.Offset(1, -1)
zipcode1.Value = zipcode1 & zipcode2.Value
transit.Offset(1, 0).EntireRow.Delete
Loop
Set transit = transit.Offset(1, 0)
Loop

Set transit = Range("A2")
Do Until transit.Value = ""
transit.Value = Left(transit.Value, 5) & " - " & Right(transit.Value, 5)
Set transit = transit.Offset(1, 0)
Loop

End Sub

--
-SA


"Jerry" wrote:

This is what I have:

Zipcodes Transit time
00501 5
00502 5
00503 5
11001 1
11002 1

I need to replace this with:

Zipcode Ranges Transit Time
00501 - 00503 5
11001 - 11002 1

Thank you for all your assistance

"StumpedAgain" wrote:

Perhaps a quick "this is what I have" and "this is what I want" would help.
I.e.

What I have:
Zipcodes Transit Times
94534 4
65481 5
etc.

What I want:
??

I guess I'm confused on what you're looking to get out of it. Do you want a
count of all the ranges between certain values? How are you looking to
consolidate these zip codes?

I'm not sure this is what you're looking for but perhaps a slight
modification to what I posted befo

=IF(A1<1001,"1-1000",IF(A1<1251,"1001-1250",IF(A1<2501,"1251-2500",IF(etc.))))

Let me know!
--
-SA


"Jerry" wrote:

The figures 1 thru 1000 were an example, I need a formula to create the
actual range based on the value in Column B.

"StumpedAgain" wrote:

Maybe I'm not understanding correctly, but if you follow this if statement it
can give you what you stated below.

=IF(A1<1001,1,IF(A1<1251,2,IF(A1<2501,3,IF(etc.))) )

This what you're looking for?
--
-SA


"Jerry" wrote:

I need to consolidate data from 2 columns. Column A has over 40,000 unique
values, Column B has only 5. I need to consolidate Column A into ranges. I.e.
1 thru 1000 = 1. 1001 thry 1250 = 2. 1251 thru 2500 = 1. etc.
Thanks

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 142
Default How do I consolidate data into ranges

I am unfamiliar with VBA, and do not own the program. Is this something than
can be done in Excel?

"StumpedAgain" wrote:

OOhh... well then... I would use the following in VBA. I used it on a quick
test string and it worked for me. Let me know how it goes!


Option Explicit
Sub consolidation()

Dim transit, zipcode1, zipcode2 As Range

Set transit = Range("B2")

Do Until transit.Value = ""
Set zipcode1 = transit.Offset(0, -1)
Do Until transit < transit.Offset(1, 0)
Set zipcode2 = transit.Offset(1, -1)
zipcode1.Value = zipcode1 & zipcode2.Value
transit.Offset(1, 0).EntireRow.Delete
Loop
Set transit = transit.Offset(1, 0)
Loop

Set transit = Range("A2")
Do Until transit.Value = ""
transit.Value = Left(transit.Value, 5) & " - " & Right(transit.Value, 5)
Set transit = transit.Offset(1, 0)
Loop

End Sub

--
-SA


"Jerry" wrote:

This is what I have:

Zipcodes Transit time
00501 5
00502 5
00503 5
11001 1
11002 1

I need to replace this with:

Zipcode Ranges Transit Time
00501 - 00503 5
11001 - 11002 1

Thank you for all your assistance

"StumpedAgain" wrote:

Perhaps a quick "this is what I have" and "this is what I want" would help.
I.e.

What I have:
Zipcodes Transit Times
94534 4
65481 5
etc.

What I want:
??

I guess I'm confused on what you're looking to get out of it. Do you want a
count of all the ranges between certain values? How are you looking to
consolidate these zip codes?

I'm not sure this is what you're looking for but perhaps a slight
modification to what I posted befo

=IF(A1<1001,"1-1000",IF(A1<1251,"1001-1250",IF(A1<2501,"1251-2500",IF(etc.))))

Let me know!
--
-SA


"Jerry" wrote:

The figures 1 thru 1000 were an example, I need a formula to create the
actual range based on the value in Column B.

"StumpedAgain" wrote:

Maybe I'm not understanding correctly, but if you follow this if statement it
can give you what you stated below.

=IF(A1<1001,1,IF(A1<1251,2,IF(A1<2501,3,IF(etc.))) )

This what you're looking for?
--
-SA


"Jerry" wrote:

I need to consolidate data from 2 columns. Column A has over 40,000 unique
values, Column B has only 5. I need to consolidate Column A into ranges. I.e.
1 thru 1000 = 1. 1001 thry 1250 = 2. 1251 thru 2500 = 1. etc.
Thanks

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 192
Default How do I consolidate data into ranges

Hey Jerry, no problem.

To start a new macro:
Open excel and press Alt + F11
Start a new module by going to Insert-Module
Paste the below programming into the module.

To run the macro:
Go to the sheet on which you want to run the macro
Go to Tools-Macro-Macros...
Select the consolidation macro and click run

As this is your first macro, make sure to save a copy before you run a macro
because there is no "undo" after running a macro!

Also note that the macro starts in "B2". If your transit times start
anywhere else, you have to change the code.

Let me know if you have any questions!!!

--
-SA


"Jerry" wrote:

I am unfamiliar with VBA, and do not own the program. Is this something than
can be done in Excel?

"StumpedAgain" wrote:

OOhh... well then... I would use the following in VBA. I used it on a quick
test string and it worked for me. Let me know how it goes!


Option Explicit
Sub consolidation()

Dim transit, zipcode1, zipcode2 As Range

Set transit = Range("B2")

Do Until transit.Value = ""
Set zipcode1 = transit.Offset(0, -1)
Do Until transit < transit.Offset(1, 0)
Set zipcode2 = transit.Offset(1, -1)
zipcode1.Value = zipcode1 & zipcode2.Value
transit.Offset(1, 0).EntireRow.Delete
Loop
Set transit = transit.Offset(1, 0)
Loop

Set transit = Range("A2")
Do Until transit.Value = ""
transit.Value = Left(transit.Value, 5) & " - " & Right(transit.Value, 5)
Set transit = transit.Offset(1, 0)
Loop

End Sub

--
-SA


"Jerry" wrote:

This is what I have:

Zipcodes Transit time
00501 5
00502 5
00503 5
11001 1
11002 1

I need to replace this with:

Zipcode Ranges Transit Time
00501 - 00503 5
11001 - 11002 1

Thank you for all your assistance

"StumpedAgain" wrote:

Perhaps a quick "this is what I have" and "this is what I want" would help.
I.e.

What I have:
Zipcodes Transit Times
94534 4
65481 5
etc.

What I want:
??

I guess I'm confused on what you're looking to get out of it. Do you want a
count of all the ranges between certain values? How are you looking to
consolidate these zip codes?

I'm not sure this is what you're looking for but perhaps a slight
modification to what I posted befo

=IF(A1<1001,"1-1000",IF(A1<1251,"1001-1250",IF(A1<2501,"1251-2500",IF(etc.))))

Let me know!
--
-SA


"Jerry" wrote:

The figures 1 thru 1000 were an example, I need a formula to create the
actual range based on the value in Column B.

"StumpedAgain" wrote:

Maybe I'm not understanding correctly, but if you follow this if statement it
can give you what you stated below.

=IF(A1<1001,1,IF(A1<1251,2,IF(A1<2501,3,IF(etc.))) )

This what you're looking for?
--
-SA


"Jerry" wrote:

I need to consolidate data from 2 columns. Column A has over 40,000 unique
values, Column B has only 5. I need to consolidate Column A into ranges. I.e.
1 thru 1000 = 1. 1001 thry 1250 = 2. 1251 thru 2500 = 1. etc.
Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Consolidate Data jlclyde Excel Discussion (Misc queries) 0 January 4th 08 06:11 PM
consolidate data kim Excel Worksheet Functions 1 October 29th 07 11:36 PM
Data Consolidate Ed Excel Discussion (Misc queries) 0 June 19th 07 02:17 AM
help to consolidate data docdutton Excel Worksheet Functions 1 June 9th 07 08:45 PM
consolidate data Chi Excel Discussion (Misc queries) 0 September 28th 06 05:12 PM


All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"