Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default If formula within Vlookup

I am working with a payroll spreadsheet. I would like to have vlookup choose
between two different tables to do a search. For example, for federal taxes
I have two tables, one for single and one for married. Instead of entering
"single" or "married" (the range names of my tables) in the actual formula, I
would like excel to lookup either or from a specific cell and act depending
of what is written on that cell (either "single" or "married"). The same
thing would go for the amount of allowances (which would be the column index
numbers.) I have tried writing the cell id, but excel gives me a "value"
error message. Would there be any possible solution out there? Thank you
very much.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default If formula within Vlookup

Use an if statement to execute one fo two vlookups something like this

if(A1 = "Single", Vlookup(?, SingleRange, ?, false), if(A1 = "Married",
Vlookup(?, MarriedRange, ?, false), "Error"))
--
HTH...

Jim Thomlinson


"Roberto" wrote:

I am working with a payroll spreadsheet. I would like to have vlookup choose
between two different tables to do a search. For example, for federal taxes
I have two tables, one for single and one for married. Instead of entering
"single" or "married" (the range names of my tables) in the actual formula, I
would like excel to lookup either or from a specific cell and act depending
of what is written on that cell (either "single" or "married"). The same
thing would go for the amount of allowances (which would be the column index
numbers.) I have tried writing the cell id, but excel gives me a "value"
error message. Would there be any possible solution out there? Thank you
very much.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default If formula within Vlookup

=VLOOKUP($A2,INDIRECT(E1),2,0)

E1="Single" or "Married"

"Roberto" wrote:

I am working with a payroll spreadsheet. I would like to have vlookup choose
between two different tables to do a search. For example, for federal taxes
I have two tables, one for single and one for married. Instead of entering
"single" or "married" (the range names of my tables) in the actual formula, I
would like excel to lookup either or from a specific cell and act depending
of what is written on that cell (either "single" or "married"). The same
thing would go for the amount of allowances (which would be the column index
numbers.) I have tried writing the cell id, but excel gives me a "value"
error message. Would there be any possible solution out there? Thank you
very much.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default If formula within Vlookup

Fantastic. These work perfectly. Thank you both for your help.

Regards
Roberto

"Toppers" wrote:

=VLOOKUP($A2,INDIRECT(E1),2,0)

E1="Single" or "Married"

"Roberto" wrote:

I am working with a payroll spreadsheet. I would like to have vlookup choose
between two different tables to do a search. For example, for federal taxes
I have two tables, one for single and one for married. Instead of entering
"single" or "married" (the range names of my tables) in the actual formula, I
would like excel to lookup either or from a specific cell and act depending
of what is written on that cell (either "single" or "married"). The same
thing would go for the amount of allowances (which would be the column index
numbers.) I have tried writing the cell id, but excel gives me a "value"
error message. Would there be any possible solution out there? Thank you
very much.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default If formula within Vlookup

Probably not an issue but it is important to note that Indirect is a volatile
function meaning that it is recacluated every time as opposed to only when
one of its precidents has changed. If you intend to have a lot (hundereds or
thousands) of these formulas then you will take a significant performance
hit. I personally avoid indirect (or any volatile function) wherever another
formula will work. Just my 2 cents...
--
HTH...

Jim Thomlinson


"rrodriguezdiaz30" wrote:

Fantastic. These work perfectly. Thank you both for your help.

Regards
Roberto

"Toppers" wrote:

=VLOOKUP($A2,INDIRECT(E1),2,0)

E1="Single" or "Married"

"Roberto" wrote:

I am working with a payroll spreadsheet. I would like to have vlookup choose
between two different tables to do a search. For example, for federal taxes
I have two tables, one for single and one for married. Instead of entering
"single" or "married" (the range names of my tables) in the actual formula, I
would like excel to lookup either or from a specific cell and act depending
of what is written on that cell (either "single" or "married"). The same
thing would go for the amount of allowances (which would be the column index
numbers.) I have tried writing the cell id, but excel gives me a "value"
error message. Would there be any possible solution out there? Thank you
very much.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLOOKUP Formula Jackie Excel Discussion (Misc queries) 2 July 18th 07 09:58 PM
VLOOKUP FORMULA? FC Excel Discussion (Misc queries) 4 March 22nd 07 05:48 PM
Excel 2002 VLOOKUP formula or other formula Serge Excel Discussion (Misc queries) 4 February 26th 07 03:56 PM
Using a Vlookup within an IF formula Balticjo Excel Discussion (Misc queries) 7 January 15th 07 09:58 PM
IF & VLOOKUP FORMULA taxmom Excel Worksheet Functions 3 March 2nd 05 03:35 PM


All times are GMT +1. The time now is 09:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"