Repeat a value n times across columns in a single row based on cell condition in another row

abyouki

New Member
Joined
Jul 14, 2020
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hello,
I am in the process of creating a maintenance schedule for some equipment (Weekly, Monthly, 6 Months and Annual).

I have a list of equipment in a column and a planner in other columns, i want to repeat the letter "W" when the corresponding cell date is > the previous weekly maintenance +7 days, letter M should appear when the last three columns had "W" , S should appear when the letter M was repeated 5 times, etc. is there a vba code or formula to automate that? i tried using the following formula, which worked fine for the first couple entries but then the letter M keeps repeating across the row: =IF(AND($H$18="W",O15=$H$15+(7*(COUNTIF($H$18:N$18,"W")))),"W",IF(COUNTIF($H$18:N$18,"W")=3,"M",""))

Capture 2.JPG

Capture.JPG
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,214,983
Messages
6,122,583
Members
449,089
Latest member
Motoracer88

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