Apply a function after finding a column header

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,057
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have headers name Cand. Final Status and Email Flag, this headers may move left of right as per the need of a user, is there a vba / or a function that can be applied row wise
currently I am using this function
Excel Formula:
=IF(AND(AN2="Rejected",AO2=""),1,"")
, it is valid if column AN (Cand. Final Status) and column AO (Email Flag) are unmoved

currently using this vba code
VBA Code:
With Worksheets("Candidate Master")
    With .Range("cb2:cb" & .Range("b" & .Rows.Count).End(xlUp).Row)
        .Formula = "=IF(AND(AN2=""Rejected"",AO2=""""),1,"""")"
        .Value = .Value
        '.NumberFormat = "DD-MM-YYYY"
     End With
End With

but need a way a vba code or function as it will first find columns (Cand. Final Status & Email Flag) and then apply function row wise.
any suggestion.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Not clear for me.
Just guess:
Search row 1 for "Cand.Final Status" with row 2 is "Rejected" AND row 1 for "Email Flag" with row2 is "blank". If both match then input 1 into range column CB2:CB last row?
If not, try to post a screenshot.
 
Upvote 0
Not clear for me.
Just guess:
Search row 1 for "Cand.Final Status" with row 2 is "Rejected" AND row 1 for "Email Flag" with row2 is "blank". If both match then input 1 into range column CB2:CB last row?
If not, try to post a screenshot.
search header names in Row 1 and then apply formula from row 2 till the last row.

screen shot
 

Attachments

  • Screen.jpg
    Screen.jpg
    47.5 KB · Views: 3
Upvote 0
Formula version:
Code:
=IFERROR(1/(1/(INDEX($B2:$CA2,MATCH("Cand.Final Status",$B$1:$CA$1,0))="Rejected")/(INDEX($B2:$CA2,MATCH("Email Flag",$B$1:$CA$1,0))="")),"")
Drag down
Capture.JPG
 
Upvote 0
Solution

Forum statistics

Threads
1,214,667
Messages
6,120,821
Members
448,990
Latest member
rohitsomani

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