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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,215,042
Messages
6,122,810
Members
449,095
Latest member
m_smith_solihull

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