+ Reply to Thread
Results 1 to 6 of 6

If condition in calculated field

  1. #1
    Registered User
    Join Date
    08-14-2012
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    35

    If condition in calculated field

    Hi,
    I have a table which I cannot modify, so I have to try and get this data through pivot table.

    Here is the sample data -

    order id, orders
    fndsfs, 9
    nskfs , 8
    , 5
    , 4

    I want a pivot table that will show me below type of pivot =

    "Blank Order Id" | "Non Blank Order Id"
    9 | 17

    I believe I can do this if I use "if" condition in the calculated item. Please help.
    Attached Files Attached Files
    Last edited by amitdi; 09-18-2021 at 11:04 AM.

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: If condition in calculated field

    can you load a sample spreadsheet - NOT the entire thing, but a small representative sample , with the data (make sure nothing personal / private in the data and can be shared on public forum ) with the results you expect.
    see the yellow banner at top of scree
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    08-14-2012
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    35

    Re: If condition in calculated field

    Quote Originally Posted by etaf View Post
    can you load a sample spreadsheet - NOT the entire thing, but a small representative sample , with the data (make sure nothing personal / private in the data and can be shared on public forum ) with the results you expect.
    see the yellow banner at top of scree
    Yes, should have done that. I edited my original post to attach a sample. In the sample, you have the 2 rows with order id on separate rows and there is 1 row with blank order id. I need to see count for both populated order id in a single column. and the count for all blank order id in another column.

    I can group the order id, but in my data I dont know what the order ids will be, there can also be new order ids, so group needs to be dynamic. I open to some VBA programming as well as a last resort.
    Last edited by amitdi; 09-18-2021 at 11:08 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: If condition in calculated field

    With power query you can easily add a column and link it to the data model. Otherwise you will have to add a formula to the table.
    Attached Files Attached Files
    Messages have been translated from Dutch to English by means of google translate.

  5. #5
    Registered User
    Join Date
    08-14-2012
    Location
    Canada
    MS-Off Ver
    Excel 2016
    Posts
    35

    Re: If condition in calculated field

    Quote Originally Posted by Vraag en antwoord View Post
    With power query you can easily add a column and link it to the data model. Otherwise you will have to add a formula to the table.
    I didnt know about Power Query, just vaguely heard about it.

    I looked at this along with the code. Prima facie, this looks like it will do the job. I will see how I can incorporate this with my main file, but I dont see any roadblocks there. Much thanks.

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,598

    Re: If condition in calculated field

    dynamic named range:
    OrderCounts =Sheet1!$A$2:INDEX(Sheet1!$B:$B,COUNTA(Sheet1!$B:$B))

    sum of blanks:
    Please Login or Register  to view this content.
    sum of id'd
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Creating calculated field and calculated item into a pivot table
    By dvpe in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 12-12-2019, 12:15 PM
  2. Replies: 0
    Last Post: 08-15-2016, 02:07 PM
  3. Replies: 0
    Last Post: 04-27-2015, 03:32 PM
  4. If condition within a pivot table-Calculated field
    By pdalal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2014, 11:30 AM
  5. Replies: 0
    Last Post: 10-24-2013, 10:59 AM
  6. Replies: 0
    Last Post: 06-26-2012, 09:06 PM
  7. [SOLVED] pivot table formulas for calculated field or calculated item
    By Vicky in forum Excel General
    Replies: 3
    Last Post: 06-06-2006, 12:10 AM

Tags for this Thread

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