HawaiianShirts
New Member
- Joined
- Jul 19, 2014
- Messages
- 15
- Office Version
- 365
- Platform
- Windows
I've got a report that produces a rather nice table with data categorized by the first column. However, to get it to work with another process as required by my employer, I need to get the data for each category into a single row. For example, if it was addresses categorized by state, the source data might look something like this:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]State
[/TD]
[TD="align: center"]Customer
[/TD]
[TD="align: center"]Address
[/TD]
[TD="align: center"]City
[/TD]
[TD="align: center"]ZIP
[/TD]
[/TR]
[TR]
[TD]California[/TD]
[TD]Steve[/TD]
[TD]505 Main[/TD]
[TD]Sacramento[/TD]
[TD]94208[/TD]
[/TR]
[TR]
[TD]California[/TD]
[TD]Jenny[/TD]
[TD]9811 Lincoln[/TD]
[TD]San Francisco[/TD]
[TD]94119[/TD]
[/TR]
[TR]
[TD]Oregon[/TD]
[TD]Carl[/TD]
[TD]3000 Sandy[/TD]
[TD]Portland[/TD]
[TD]97216[/TD]
[/TR]
[TR]
[TD]Oregon[/TD]
[TD]Susan[/TD]
[TD]65 Center[/TD]
[TD]Salem[/TD]
[TD]97301[/TD]
[/TR]
[TR]
[TD]Oregon[/TD]
[TD]Larry[/TD]
[TD]1010 State[/TD]
[TD]Eugene[/TD]
[TD]97404[/TD]
[/TR]
[TR]
[TD]Washington[/TD]
[TD]Edward[/TD]
[TD]777 Bridgeway[/TD]
[TD]Seattle[/TD]
[TD]98139[/TD]
[/TR]
[TR]
[TD]Washington[/TD]
[TD]Anna[/TD]
[TD]789 Bridgeway[/TD]
[TD]Seattle[/TD]
[TD]98139[/TD]
[/TR]
</tbody>[/TABLE]
When I try to get a separate worksheet to populate with this data in the required format, I would need three rows that look something like this:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]State
[/TD]
[TD="align: center"]Customer 1
[/TD]
[TD="align: center"]Address 1
[/TD]
[TD="align: center"]City 1
[/TD]
[TD="align: center"]ZIP 1
[/TD]
[TD="align: center"]Customer 2
[/TD]
[TD="align: center"]Address 2
[/TD]
[TD="align: center"]City 2
[/TD]
[TD="align: center"]ZIP 2
[/TD]
[TD="align: center"]Customer 3
[/TD]
[TD="align: center"]Address 3
[/TD]
[TD="align: center"]City 3
[/TD]
[TD="align: center"]ZIP 3
[/TD]
[/TR]
[TR]
[TD]California[/TD]
[TD]Steve[/TD]
[TD]505 Main[/TD]
[TD]Sacramento[/TD]
[TD]94208[/TD]
[TD]Jenny[/TD]
[TD]9811 Lincoln[/TD]
[TD]San Francisco[/TD]
[TD]94119[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Oregon[/TD]
[TD]Carl[/TD]
[TD]3000 Sandy[/TD]
[TD]Portland[/TD]
[TD]97216[/TD]
[TD]Susan[/TD]
[TD]65 Center[/TD]
[TD]Salem[/TD]
[TD]97301[/TD]
[TD]Larry[/TD]
[TD]1010 State[/TD]
[TD]Eugene[/TD]
[TD]97404[/TD]
[/TR]
[TR]
[TD]Washington[/TD]
[TD]Edward[/TD]
[TD]777 Bridgeway[/TD]
[TD]Seattle[/TD]
[TD]98139[/TD]
[TD]Anna[/TD]
[TD]778 Bridgeway[/TD]
[TD]Seattle[/TD]
[TD]98139[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The State column will change each time I need to collect this data, and each row will have a different state. If I have to, it would not pose a problem to have blank cells. For example, "Oregon" would still appear under the State column, but Carl, Susan, and Larry would appear under Customer 3, Customer 4, and Customer 5, and then "Washington" would also still appear under the State column, but Edward and Anna would appear under Customer 6 and Customer 7.
After referring to some other forum stuff and online guides, I managed to get an OFFSET formula to work, even if I don't totally understand it. Then I added an IF statement to the beginning of my OFFSET formula. This is the actual formula and does not refer to the example tables above.
The problem is that the IF part doesn't seem to work. The whole row populates with data from the source sheet no matter what's in the State column. If "State" shows Oregon, I get all the Oregon addresses, but I also get the Washington and California addresses.
What am I doing wrong? Is there an easier way?
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]State
[/TD]
[TD="align: center"]Customer
[/TD]
[TD="align: center"]Address
[/TD]
[TD="align: center"]City
[/TD]
[TD="align: center"]ZIP
[/TD]
[/TR]
[TR]
[TD]California[/TD]
[TD]Steve[/TD]
[TD]505 Main[/TD]
[TD]Sacramento[/TD]
[TD]94208[/TD]
[/TR]
[TR]
[TD]California[/TD]
[TD]Jenny[/TD]
[TD]9811 Lincoln[/TD]
[TD]San Francisco[/TD]
[TD]94119[/TD]
[/TR]
[TR]
[TD]Oregon[/TD]
[TD]Carl[/TD]
[TD]3000 Sandy[/TD]
[TD]Portland[/TD]
[TD]97216[/TD]
[/TR]
[TR]
[TD]Oregon[/TD]
[TD]Susan[/TD]
[TD]65 Center[/TD]
[TD]Salem[/TD]
[TD]97301[/TD]
[/TR]
[TR]
[TD]Oregon[/TD]
[TD]Larry[/TD]
[TD]1010 State[/TD]
[TD]Eugene[/TD]
[TD]97404[/TD]
[/TR]
[TR]
[TD]Washington[/TD]
[TD]Edward[/TD]
[TD]777 Bridgeway[/TD]
[TD]Seattle[/TD]
[TD]98139[/TD]
[/TR]
[TR]
[TD]Washington[/TD]
[TD]Anna[/TD]
[TD]789 Bridgeway[/TD]
[TD]Seattle[/TD]
[TD]98139[/TD]
[/TR]
</tbody>[/TABLE]
When I try to get a separate worksheet to populate with this data in the required format, I would need three rows that look something like this:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]State
[/TD]
[TD="align: center"]Customer 1
[/TD]
[TD="align: center"]Address 1
[/TD]
[TD="align: center"]City 1
[/TD]
[TD="align: center"]ZIP 1
[/TD]
[TD="align: center"]Customer 2
[/TD]
[TD="align: center"]Address 2
[/TD]
[TD="align: center"]City 2
[/TD]
[TD="align: center"]ZIP 2
[/TD]
[TD="align: center"]Customer 3
[/TD]
[TD="align: center"]Address 3
[/TD]
[TD="align: center"]City 3
[/TD]
[TD="align: center"]ZIP 3
[/TD]
[/TR]
[TR]
[TD]California[/TD]
[TD]Steve[/TD]
[TD]505 Main[/TD]
[TD]Sacramento[/TD]
[TD]94208[/TD]
[TD]Jenny[/TD]
[TD]9811 Lincoln[/TD]
[TD]San Francisco[/TD]
[TD]94119[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Oregon[/TD]
[TD]Carl[/TD]
[TD]3000 Sandy[/TD]
[TD]Portland[/TD]
[TD]97216[/TD]
[TD]Susan[/TD]
[TD]65 Center[/TD]
[TD]Salem[/TD]
[TD]97301[/TD]
[TD]Larry[/TD]
[TD]1010 State[/TD]
[TD]Eugene[/TD]
[TD]97404[/TD]
[/TR]
[TR]
[TD]Washington[/TD]
[TD]Edward[/TD]
[TD]777 Bridgeway[/TD]
[TD]Seattle[/TD]
[TD]98139[/TD]
[TD]Anna[/TD]
[TD]778 Bridgeway[/TD]
[TD]Seattle[/TD]
[TD]98139[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The State column will change each time I need to collect this data, and each row will have a different state. If I have to, it would not pose a problem to have blank cells. For example, "Oregon" would still appear under the State column, but Carl, Susan, and Larry would appear under Customer 3, Customer 4, and Customer 5, and then "Washington" would also still appear under the State column, but Edward and Anna would appear under Customer 6 and Customer 7.
After referring to some other forum stuff and online guides, I managed to get an OFFSET formula to work, even if I don't totally understand it. Then I added an IF statement to the beginning of my OFFSET formula. This is the actual formula and does not refer to the example tables above.
=IF($A2=Sheet4!$A:$A,(OFFSET(Sheet4!$A$1,((ROW()-1)*1)+(FLOOR(COLUMN()-1,7)/7),(COLUMN()-1)-(FLOOR(COLUMN()-1,7)))),"")
The problem is that the IF part doesn't seem to work. The whole row populates with data from the source sheet no matter what's in the State column. If "State" shows Oregon, I get all the Oregon addresses, but I also get the Washington and California addresses.
What am I doing wrong? Is there an easier way?
Last edited: