Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Searching and noting all card numbers pointing to each individual card

Hello,


this is what i'm trying to achieve:


Column A has a list of card numbers (lets say from 1 - 1000).


Column B has a text that would be on that particular card (card number in column A). The text may mention no card at all, may mention one card or multiple cards.

Example:

"You are at the junction.

Go left - find card 8.

Go right - find card 3.

You can go straight - Find card 4."


Column C shows list of all cards that mention this particular card. So if card number 2, 3 & 4 mention card 1 then column C of card 1 should say 2,3,4.

So basically I'm trying to take the number in column 1, look if exactly the same number is mentioned in another column (or two) and if yes write all of those card numbers in column C of the card which number we were searching for.


Hopefully it makes sense.


Thanks a lot.



MacBook Pro Retina

Posted on Jan 17, 2019 2:58 PM

Reply
6 replies

Jan 20, 2019 7:08 AM in response to SGIII

Here's a bare bones script solution. It works on table you posted above.


  1. Copy-paste script below into Script Editor (in Applications > Utilities)
  2. Make sure Script Editor is listed and checked at System Preferences > Security & Privacy > Privacy & Accessibility.
  3. Click in the Numbers table.
  4. Click the triangle 'Run' button in Script Editor.
  5. Click in the top cell where you want the card references to appear (in the example C2).
  6. Command-v to paste.


You may have to 'Adjust Settings' to deselect the column delimiter so the values appear comma-separated as in your post.


SG


set dataStartRow to 2
tell application "Numbers"
	tell front document's active sheet
		tell (first table whose selection range's class is range)
			set vv to rows's cells's formatted value
		end tell
	end tell
end tell

set text item delimiters to ","
set cardRefPasteStr to ""
set maxCtr to vv's length
repeat with i from dataStartRow to maxCtr
	set thisCardNum to vv's item i's item 1
	set cardRefs to {}
	repeat with j from dataStartRow to maxCtr
		if vv's item j's item 2 contains thisCardNum then
			copy vv's item j's item 1 to cardRefs's end
		end if
	end repeat
	set cardRefPasteStr to cardRefPasteStr & cardRefs & return
end repeat
set the clipboard to cardRefPasteStr
return cardRefPasteStr

Jan 19, 2019 1:58 AM in response to cubeec

I think it would be even more work with formulas and extra columns to hold them, even if it is possible to handle that large a number of cards.


You could facilitate the process of doing this manually by first filtering on "find card 1" and adding their numbers to card 1's column C, then filtering on "find card 2", etc.


SG


Searching and noting all card numbers pointing to each individual card

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.