Help to fill fomula with conditions to last column

nhnn1986

Board Regular
Joined
Oct 12, 2017
Messages
92
Hi all:

I have excel file with sheet(result") and alot of sheets("ABCxxxxxxxx") with xxxxxxxx is number, the number of sheets("ABCxxxxxxxx") dynamic

Now I want to fill in some fomula from column E to last column that row(1) have data by macro with conditions that:

Code:
Each Cell(1,i) in range(cells(1,5),cells(1,lastcolumn)), i = 5 to lastcolumn
     if Cells(1,i).Value = right(sheets(j).name,8).Value then
          Cells(5,i).fomula =+SUMIF(sheets(j)!$B$2:$B$1931;"R-2110";sheets(j)!$K$2:$K$1931)+SUMIF(sheets(j)!$B$2:$B$1931;"R-2110";sheets(j)!$O$2:$O$1931)
          Cells(6,i).fomula =+SUMIF(sheets(j)!$B$2:$B$1931;"R-1213";sheets(j)!$K$2:$K$1931)
     End if
Next cells

https://imgur.com/a/JqMaMbX
All Fomula that I need look like the image I attach, please help me. Many thanks./.
JqMaMbX
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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