Formula to populate either "Up" or "Down" based on location of entry in Column A

y3tter

Board Regular
Joined
Nov 11, 2012
Messages
147
I have three columns. Only one cell in column A will have a value, which will be "Active". Column B is locations. In column C I'm trying to get anything that at or below the "Active" indicator to populate as "Down" and anything above the "Active" marker to populate as "Up".

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Minn[/TD]
[TD]Up[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Lars[/TD]
[TD]Up[/TD]
[/TR]
[TR]
[TD]Active[/TD]
[TD]X5[/TD]
[TD]Down[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Lars_1[/TD]
[TD]Down[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Y2[/TD]
[TD]Down[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Z6[/TD]
[TD]Down[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Assuming data starts in row 1, try:
Code:
Sub y3etter()
    Application.ScreenUpdating = False
    Dim LastRow As Long, fnd As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    fnd = Range("A:A").Find("Active").Row
    Range("C1:C" & fnd - 1) = "Up"
    Range("C" & fnd & ":C" & LastRow) = "Down"
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Hey,

try this formula in C1 and drag it down:

=IF(COUNTIF($A$1:A1,"Active")=1,"Down","Up")
 
Upvote 0
Assuming data starts in row 1, try:
Code:
Sub y3etter()
    Application.ScreenUpdating = False
    Dim LastRow As Long, fnd As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    fnd = Range("A:A").Find("Active").Row
    Range("C1:C" & fnd - 1) = "Up"
    Range("C" & fnd & ":C" & LastRow) = "Down"
    Application.ScreenUpdating = True
End Sub


Thank you!!
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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