+ Reply to Thread
Results 1 to 5 of 5

Macro code using IF case with variable inputs for logical test condition

Hybrid View

m2krishnan Macro code using IF case with... 02-16-2013, 12:06 PM
Yraen Re: Macro code using IF case... 02-16-2013, 12:11 PM
m2krishnan Re: Macro code using IF case... 02-16-2013, 12:24 PM
Yraen Re: Macro code using IF case... 02-16-2013, 12:28 PM
m2krishnan Re: Macro code using IF case... 02-16-2013, 10:59 PM
  1. #1
    Registered User
    Join Date
    01-31-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    4

    Macro code using IF case with variable inputs for logical test condition

    My aim is to take a item from column x and do a lookup in different sheet and if we have match, take the result which needs to be checked with a value in a cell in current sheet. If this passes do the action else return 0.

    My formula is
    x=76
    Temp="$" Chr(x) & 6
    Cells(Emp_Tag, Date_Tag) = "=IF(Temp=(VLOOKUP($B" & Emp_Tag & ",'Data'!A1:I" & Rows_From & ",3,FALSE)),'Data'!H" & Rate_Count & ")"
    
    Where 
    Cells(Emp_Tag,Date_Tag) - Final cell on which target needs to be filled.
    Temp - Cell in current Sheet.[Contains date]
    VLOOKUP(...) takes a Id goes to Data Sheet and if found match return corresponding third column value[A date value]
    Problem is that When I use F6 instead of Temp its doing fine, if i use variable 'Temp' its printing 'Temp' instead of F6 as i have Assigned F6 to Temp. so formula fails... Please help what i am doing wrong.

    Thanks,
    Mk
    Last edited by Leith Ross; 02-17-2013 at 12:56 AM. Reason: Added Code Tags

  2. #2
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Oklahoma
    MS-Off Ver
    Office 2007 / Office 2010
    Posts
    123

    Re: Macro code using IF case with variable inputs for logical test condition

    Temp="$" & Chr(x) & 6
    Cells(Emp_Tag, Date_Tag) = "=IF(" & Temp & "=(VLOOKUP($B" & Emp_Tag & ",'Data'!A1:I" & Rows_From & ",3,FALSE)),'Data'!H" & Rate_Count & ")"

  3. #3
    Registered User
    Join Date
    01-31-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Macro code using IF case with variable inputs for logical test condition

    Many Thanks for the reply and It did resolve the issue. Will let you know If I face any more issues.
    Thanks again.

  4. #4
    Forum Contributor
    Join Date
    01-13-2013
    Location
    Oklahoma
    MS-Off Ver
    Office 2007 / Office 2010
    Posts
    123

    Re: Macro code using IF case with variable inputs for logical test condition

    You're welcome.

  5. #5
    Registered User
    Join Date
    01-31-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Macro code using IF case with variable inputs for logical test condition

    Just another query in same line.
    Cells(Emp_Tag, Date_Tag) = "=IF(" & Temp & "=(VLOOKUP($B" & Emp_Tag & ",'Data'!A1:I" & Rows_From & ",3,FALSE)),?????)"
    Here VLOOKUP takes input as Id[B*] and checks in Data Sheet and if found returns 3rd column[Date] which is compared with temp.
    Here if this is true, the action to be done is to fetch corresponding 6th column.[ I mean the row in which Id matched and Temp equals fetch its corresponding 6th column] What needs to be done here ??

    Hope I am clear.

    Thanks,
    Last edited by Leith Ross; 02-17-2013 at 12:57 AM. Reason: Added Code Tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1