VBA Formula

Vishaal

Well-known Member
Joined
Mar 16, 2019
Messages
533
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
  2. Web
Hi All

Thanks in advance,

I have the following sheet

Excel 2010 32 bit
A
B
C
D
E
1
S.No.​
25689​
365478​
2569​
25698​
2
2564​
2145​
1425​
1478​
3
4
1​
25​
5​
8​
20​
5
2​
30​
10​
10​
23​
6
3​
35​
20​
12​
26​
7
4​
40​
30​
14​
29​
8
5​
45​
40​
16​
31​
9
6​
50​
50​
18​
33​
10
7​
55​
19​
36​
11
8​
60​
39​
12
9​
65​
41​
13
10​
70​
42​
14
11​
43​
15
12​
Sheet: Sheet1

and need the following result in same sheet

Excel 2010 32 bit
A
B
C
D
E
1
S.No.​
25689​
365478​
2569​
25698​
2
2564​
2145​
1425​
1478​
3
4
1​
5
2​
6
3​
Yes​
7
4​
Yes​
Yes​
8
5​
Yes​
Yes​
9
6​
Yes​
Yes​
10
7​
Yes​
Yes​
11
8​
Yes​
Yes​
12
9​
Yes​
Yes​
13
10​
Yes​
Yes​
14
11​
Yes​
15
12​
Sheet: Sheet1

We have added the "Four Yes" from bottom in every column and removed the all numbers

Pls provide the solution
 
Thank you very much Peter_SSs Sir Ji for the help

its a proud that i m a member of a great forum
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Use this code instead of what I gave you earlier and replace the red number 4 with the number of yeses you want...
Code:
Sub YesLast4Max()
  Dim LR As Long, C As Long, Yeses As Long
  Yeses = [B][COLOR=#FF0000][SIZE=2]4[/SIZE][/COLOR][/B]
  For C = 2 To Cells(4, Columns.Count).End(xlToLeft).Column
    If Len(Cells(4, C)) Then
      LR = Columns(C).Find("*", , xlValues, , xlRows, xlPrevious).Row
      With Range(Cells(4, C), Cells(LR, C))
        .Value = Evaluate("IF(ROW(" & .Address & ")>MAX(3," & LR & "-" & Yeses & "),""Yes"","""")")
      End With
    End If
  Next
End Sub


Thank you very much Rick Rothstein
Sir Ji for the help

its a proud that i m a member of a great forum
 
Upvote 0

Forum statistics

Threads
1,214,901
Messages
6,122,157
Members
449,068
Latest member
shiz11713

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