Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 29
Default if statement on a pivot table

I'm trying to find the difference of two columns of data (only on the
subtotal row) created with a pivot table, instead of the "total" that the
table gives me. I thought I would be able to put in an "if" statement,
sopmething to the effect of "if column B includes the text "total", then
subtract column E from column F. I don't want it on all rows, only the
subtotal rows, which all include the text "total".

Does anyone have an idea on how I can accomplish this?

Thanks!
Cathy
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default if statement on a pivot table

if column B includes the text "total" exactly, then the following
formula would work (copied to all rows):
=IF(B1="total",F1-E1,"")

however, if by "contains" you mean that the cell in B3 might have the
word "SubTotal" or "Sub Total" or even "Total widgets", then you will
need:
=IF(ISERROR(FIND("total",LOWER(B1))),"",F1-E1)
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 29
Default if statement on a pivot table

THANK YOU VERY MUCH.....At this time I don't know what it means, but when
copying it in, it works. I'll figure it out later so that I can apply in
other areas as well.

Thanks again.

Cathy

" wrote:

if column B includes the text "total" exactly, then the following
formula would work (copied to all rows):
=IF(B1="total",F1-E1,"")

however, if by "contains" you mean that the cell in B3 might have the
word "SubTotal" or "Sub Total" or even "Total widgets", then you will
need:
=IF(ISERROR(FIND("total",LOWER(B1))),"",F1-E1)

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default if statement on a pivot table

LOWER(B1) takes the data in B1 and puts it all in lower case letters.

FIND("total",LOWER(B1)) gets the character number in the contents of
the lower-case version of cell B1 where the text "total" starts. If
B1 contains "SubTotal" then this will return a 4. Notice that the
function translated "SubTotal" to "subtotal" first, so that it could
find "total" in there.

If B1 does not contain "total", then the FIND function will return an
error. So the whole IF statement basicaly says if there's an error
(and it's not a total row) then fill the cell with an empty string,
otherwise, fill the cell with the F1-E1 formula that you wanted.
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
how to create pivot table from existing pivot table in excel 2007 Udayraj Dhulekar Excel Discussion (Misc queries) 2 July 8th 13 08:22 PM
Copying values from pivot table to cells outside pivot table richzip Excel Discussion (Misc queries) 4 January 16th 08 11:03 PM
Filter lines with Pivot table and non pivot table columns Grover Charts and Charting in Excel 4 September 28th 07 03:16 AM
Filter lines with Pivot table and non Pivot table columns Grover Excel Discussion (Misc queries) 1 September 26th 07 12:48 AM
"IF" statement in a pivot table. Elizabeth Excel Discussion (Misc queries) 1 May 1st 05 10:48 AM


All times are GMT +1. The time now is 03:32 PM.

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

About Us

"It's about Microsoft Excel"