Formula that "searches" for a column by title

Lea

Board Regular
Joined
Oct 1, 2007
Messages
133
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I have a spreadsheet with a column that I need to total. The stinker here is that the column will move to the right as we add data to it. I am hoping to have a formula that looks for all instances of a person's name in column B and when it finds that name then find the column titled "Number of Tests". Then add the rows that contain that person's name.

This might make it simpler to understand what I need...
Here is my formula for a fixed column.
=SUMIF('Data Dump'!B:B, "*Philip*", 'Data Dump'!E:E)
But instead of E:E, I need it to search for the column labeled "Number of Tests". If it helps, "Number of Tests" will always be in row 6.

I don't even know if this is possible. I appreciate any help you can give.

Thank, you,
Lea
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
This might work:
Code:
=SUMPRODUCT(("Lea"=A7:A14)*(INDEX(A7:G14,,MATCH("Number of Tests",A6:Z6,0))))
 
Upvote 0
One way:
Book1
BCDEFGHIJKLM
3Sum
46
5
6Number of Tests
7
8
9asas1
10sad Philip asdasd2
11asdasd3
12Philip4
13
14
15
16
17
Sheet1
Cell Formulas
RangeFormula
B4B4=SUMPRODUCT(ISNUMBER(SEARCH("Philip",$B$7:$B$17))*($C$6:$M$6="Number of Tests")*$C$7:$M$17)
 
Upvote 0
Couple of other options. FILTER option will only work in Excel 365
Don't use whole column references or you will get an error.
In these examples the data starts in row 7 and I have it going to row 10000 and I have the columns going to column AZ.
Book4
ABCDEFG
1
2
3Philip38
438
5
6NameNum Test2Num Test3Number of Tests
7Ted1512
8Philip3625
9Sam581
10Philip693
11Sally5746
12Philip4216
13Philip5254
14
Sheet2
Cell Formulas
RangeFormula
C3C3=SUMIF($B$7:$B$10000,$B$3,INDEX($C$7:$Z$10000,0,MATCH("Number of Tests",$C$6:$AZ$6,0)))
C4C4=SUM(FILTER(FILTER($D$7:$AZ10000,$D$6:$AZ$6="Number of Tests"),$B$7:$B$10000=$B$3))
 
Upvote 0
Hello everyone,

Thank you so much for your answers. I am having trouble adapting all of the formulas to my spreadsheet. When I add the reference to the Data Dump sheet things go haywire. And I realized that my trying to reference the column I need titled Number of Tests won't work as the raw data has all of the columns titled the same. I have uploaded and image of the sheet named Data Dump that the formula will be referencing. The formula itself will be on a sheet named 2023.

In April, I need the totals that are in Column I. Next month we will run a report and paste it into Data Dump and column I will become the May totals and column J will be the total of all the months. So I don't know how to get YTD totals when the YTD column will move over to the right each month.

Here are just two of the formulas that I tried to adapt.
=SUM(FILTER(FILTER('Data Dump'!$E$9:$AZ10000,'Data Dump'!$E$6:$AZ$6="Number of Tests"), 'Data Dump'!$B$9:$B$10000=$A$3))
=SUMIF('Data Dump'!$B$9:$B$10000,$A$2,INDEX('Data Dump'$E$9:$Z$10000,0,MATCH("Number of Tests",'Data Dump!'$D$7:'Data Dump'$A$Z9,0)))

I am sorry this is turning into a complicated mess.

Lea

Capture.JPG
 
Upvote 0
I think you need to (a) use XL2BB to show your data and (b) explain and show where the totals in columns E to H are coming from.
 
Upvote 0
I think you need to (a) use XL2BB to show your data and (b) explain and show where the totals in columns E to H are coming from.

Hi kweaver,

Every month we run a report that pulls our testing information. We then export that data to excel. The screenshots below are what the data looks like after it is exported. As you can see the YTD total in March was in column H and in April, the YTD total moved to column I. The data is broken into sections of teams- see screenshot #3- and the same person can be on more than one team. That is why I need the formula to look at column B to identify the worker and then count the total number of tests that each person has run YTD. I don't know how to count the total number of tests since the total column will move as the year progresses. One thought I had was the range E8:P8 would cover Jan through Dec. So, I thought I could write a formula to recognize if there is a value in that range to count that column. I either did it wrong or there may be an issue because YTD total cells are merged. And I have no idea how the formula sees (screenshot #1) H8 when it is merged with H6 and H7.

My apologies, but I am on a work computer, and I do not have administrator rights. I cannot download XL2BB.

Lea



Screenshot #1
Capture2.JPG



Screenshot #2
Capture.JPG




Screenshot #3
Capture3.JPG
 
Upvote 0
RE: And I have no idea how the formula sees (screenshot #1) H8 when it is merged with H6 and H7.
When those cells are merged, the text is in H6. That's a potential issue when the other previous columns have the same text.

However, below are 2 illustrations that, when adjusted for one set of expanding data, should work.

Book1
BCDEFGHIJKLM
6Number of TestsNumber of TestsNumber of TestsTotal Number of Tests
7202320232023
8JanFebMar
9Cody, Clark2749682Total YTD
10Jones, Lea449510149Cody, Clark153
11Stevens, Don11Jones, Lea209
12Cody, Clark2242771Stevens, Don1
13Jones, Lea10203060
14
15
16
17Number of TestsNumber of TestsNumber of TestsNumber of TestsTotal Number of Tests
182023202320232023
19JanFebMarApr
20Cody, Clark27496587Total YTD
21Jones, Lea4495106155Cody, Clark161
22Stevens, Don11Jones, Lea255
23Cody, Clark22427374Stevens, Don1
24Jones, Lea10203040100
Sheet2
Cell Formulas
RangeFormula
M10:M12M10=SUMPRODUCT((L10=$B$9:$B$13)*INDEX(E$9:K$13,,MATCH("Total Number of Tests",$E$6:$K$6,0)))
H9:H13H9=SUM(E9:G9)
M21:M23M21=SUMPRODUCT((L21=$B$20:$B$24)*INDEX(E$20:K$24,,MATCH("Total Number of Tests",$E$17:$K$17,0)))
I20:I24I20=SUM(E20:H20)
 
Upvote 0
Alternatively, you could do this and adjust the bottom summary according to the number of employees there are:

Book1
BCDEFGH
6Number of TestsNumber of TestsNumber of TestsTotal Number of Tests
7202320232023
8JanFebMar
9Cody, Clark2749682
10Jones, Lea449510149
11Stevens, Don11
12Cody, Clark2242771
13Jones, Lea10203060
14
15
16
17
18Total YTD
19Cody, Clark153
20Jones, Lea209
21Stevens, Don1
Sheet2 (2)
Cell Formulas
RangeFormula
H9:H13H9=SUM(E9:G9)
B19:B21B19=UNIQUE(B9:B13)
C19:C21C19=SUMPRODUCT((B19=$B$9:$B$13)*INDEX(E$9:Q$13,,COUNTA($E$6:$Q$6)))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,631
Messages
6,120,645
Members
448,974
Latest member
DumbFinanceBro

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