Formula Help

rehberger

Board Regular
Joined
Aug 28, 2013
Messages
52
I have spreadsheet with the data set up like the first table. It runs across for 100's of columns, these are just the first 3 categories. Is there a way to pull the amounts based on the location and acct# in a set up like the second table? All of the Acct#'s in the data are not the same in each row as shown in the 4th row. Thanks for any assistance.

[TABLE="class: grid, width: 600"]
<tbody>[TR]
[TD]Location[/TD]
[TD]Acct#[/TD]
[TD]Amount[/TD]
[TD][/TD]
[TD]Location[/TD]
[TD]Acct#[/TD]
[TD]Amount[/TD]
[TD][/TD]
[TD]Location[/TD]
[TD]Acct#[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD]Reno[/TD]
[TD]1874[/TD]
[TD]291.25[/TD]
[TD][/TD]
[TD]Land[/TD]
[TD]1874[/TD]
[TD]300.00[/TD]
[TD][/TD]
[TD]Atrium[/TD]
[TD]1874[/TD]
[TD]225.50[/TD]
[/TR]
[TR]
[TD]Reno[/TD]
[TD]1875[/TD]
[TD]100.00[/TD]
[TD][/TD]
[TD]Land[/TD]
[TD]1875[/TD]
[TD]200.00[/TD]
[TD][/TD]
[TD]Atrium[/TD]
[TD]1875[/TD]
[TD]25.00[/TD]
[/TR]
[TR]
[TD]Reno[/TD]
[TD]1876[/TD]
[TD]50.50[/TD]
[TD][/TD]
[TD]Land[/TD]
[TD]1890[/TD]
[TD]80.00[/TD]
[TD][/TD]
[TD]Atrium[/TD]
[TD]1880[/TD]
[TD]75.50[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD][/TD]
[TD]Acct#[/TD]
[TD]Amount[/TD]
[/TR]
[TR]
[TD]Reno[/TD]
[TD]1874[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1875[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1876[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Atrium[/TD]
[TD]1874[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1875[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]1890[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
something like that?


[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#70AD47]Location[/td][td=bgcolor:#70AD47]Acct#[/td][td=bgcolor:#70AD47]Amount[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E2EFDA]Reno[/td][td=bgcolor:#E2EFDA]
1874​
[/td][td=bgcolor:#E2EFDA]
291.25​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Reno[/td][td]
1875​
[/td][td]
100​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E2EFDA]Reno[/td][td=bgcolor:#E2EFDA]
1876​
[/td][td=bgcolor:#E2EFDA]
50.5​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Land[/td][td]
1874​
[/td][td]
300​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E2EFDA]Land[/td][td=bgcolor:#E2EFDA]
1875​
[/td][td=bgcolor:#E2EFDA]
200​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Land[/td][td]
1890​
[/td][td]
80​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E2EFDA]Atrium[/td][td=bgcolor:#E2EFDA]
1874​
[/td][td=bgcolor:#E2EFDA]
225.5​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Atrium[/td][td]
1875​
[/td][td]
25​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E2EFDA]Atrium[/td][td=bgcolor:#E2EFDA]
1880​
[/td][td=bgcolor:#E2EFDA]
75.5​
[/td][/tr]
[/table]
 
Upvote 0
Maybe something like this


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][td="bgcolor: #DCE6F1"]
F
[/td][td="bgcolor: #DCE6F1"]
G
[/td][td="bgcolor: #DCE6F1"]
H
[/td][td="bgcolor: #DCE6F1"]
I
[/td][td="bgcolor: #DCE6F1"]
J
[/td][td="bgcolor: #DCE6F1"]
K
[/td][td="bgcolor: #DCE6F1"]
L
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Location​
[/td][td]
Acct#​
[/td][td]
Amount​
[/td][td][/td][td]
Location​
[/td][td]
Acct#​
[/td][td]
Amount​
[/td][td][/td][td]
Location​
[/td][td]
Acct#​
[/td][td]
Amount​
[/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
Reno​
[/td][td]
1874​
[/td][td]
291,25​
[/td][td][/td][td]
Land​
[/td][td]
1874​
[/td][td]
300,00​
[/td][td][/td][td]
Atrium​
[/td][td]
1874​
[/td][td]
225,50​
[/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
Reno​
[/td][td]
1875​
[/td][td]
100,00​
[/td][td][/td][td]
Land​
[/td][td]
1875​
[/td][td]
200,00​
[/td][td][/td][td]
Atrium​
[/td][td]
1875​
[/td][td]
25,00​
[/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
Reno​
[/td][td]
1876​
[/td][td]
50,50​
[/td][td][/td][td]
Land​
[/td][td]
1890​
[/td][td]
80,00​
[/td][td][/td][td]
Atrium​
[/td][td]
1880​
[/td][td]
75,50​
[/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
9
[/td][td]
Location​
[/td][td]
Column​
[/td][td]
Acct#​
[/td][td]
Amount​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
10
[/td][td]
Reno​
[/td][td]
1​
[/td][td]
1874​
[/td][td]
291,25​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
11
[/td][td][/td][td]
1​
[/td][td]
1875​
[/td][td]
100,00​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
12
[/td][td][/td][td]
1​
[/td][td]
1876​
[/td][td]
50,50​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
13
[/td][td]
Atrium​
[/td][td]
9​
[/td][td]
1874​
[/td][td]
225,50​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
14
[/td][td][/td][td]
9​
[/td][td]
1875​
[/td][td]
25,00​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
15
[/td][td][/td][td]
9​
[/td][td]
1880​
[/td][td]
75,50​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
16
[/td][td]
Land​
[/td][td]
5​
[/td][td]
1874​
[/td][td]
300,00​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
17
[/td][td][/td][td]
5​
[/td][td]
1875​
[/td][td]
200,00​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
18
[/td][td][/td][td]
5​
[/td][td]
1890​
[/td][td]
80,00​
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
19
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Formula in B10 copied down
=IF(C10="","",MATCH(LOOKUP(2,1/(A$10:A10<>""),A$10:A10),$2:$2,0))

Formula in D10 copied down
=IF(C10="","",INDEX(INDEX(A:ZZ,0,B10+2),MATCH(C10,INDEX(A:ZZ,0,B10+1),0)))

Hope this helps

M.
 
Upvote 0
Hi,

If you don't mind copying the "Location" names in each subset down column A like my sample below.

Whether you keep or not keep the Blank row between subsets is up to you, if the blank row(s) between subsets are eliminated, we won't need to test B Column for Blanks.


Book1
ABCDEFGHIJK
1LocationAcct#AmountLocationAcct#AmountLocationAcct#Amount
2Reno1874291.25Land1874300Atrium1874225.5
3Reno1875100Land1875200Atrium187525
4Reno187650.5Land189080Atrium188075.5
5
6
7Acct#Amount
8Reno1874291.25
9Reno1875100
10Reno187650.5
11
12Atrium1874225.5
13Atrium187525
14Atrium18900
15
16
17Acct#Amount
18Reno1874291.25
19Reno1875100
20Reno187650.5
21Atrium1874225.5
22Atrium187525
23Atrium18900
Sheet153
Cell Formulas
RangeFormula
C8=IF(B8="","",SUMIFS(C$2:K$4,A$2:I$4,A8,B$2:J$4,B8))
C18=SUMIFS(C$2:K$4,A$2:I$4,A18,B$2:J$4,B18)


Either formula copied down.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top